TEPA6ANT Posted February 17, 2019 Share Posted February 17, 2019 -=END=- AABB not see entity I copied code in: It turned out somehow so : function Script:Call(entity,extra) self.see=true System:Print("see") end function Script:UpdatePhysics() local position = self.entity:GetPosition(true) local aabb = AABB() aabb.min.x=position.x-30 aabb.min.y=position.y-30 aabb.min.z=position.z-30 aabb.max.x=position.x+30 aabb.max.y=position.y+30 aabb.max.z=position.z+30 aabb:Update() self.entity.world:ForEachEntityInAABBDo(aabb,"Call", self.entity) end But at the approach of any other object(e.g. the player) to this object, nothing happens. -=RUS=- AABB не видит объекты. Я взял код из Получилось как-то так : function Script:Call(entity,extra) self.see=true System:Print("see") end function Script:UpdatePhysics() local position = self.entity:GetPosition(true) local aabb = AABB() aabb.min.x=position.x-30 aabb.min.y=position.y-30 aabb.min.z=position.z-30 aabb.max.x=position.x+30 aabb.max.y=position.y+30 aabb.max.z=position.z+30 aabb:Update() self.entity.world:ForEachEntityInAABBDo(aabb,"Call", self.entity) end Но при подходе любого другого объекта(например, игрок) к этому объекту, ничего не происходит. Quote Link to comment Share on other sites More sharing options...
Slastraf Posted February 17, 2019 Share Posted February 17, 2019 Call needs to be a global function. So far you have Call in the Script as a local function. To make it global paste it in main.lua , maybe somewhere at the top : function Call(entity,extra) --not use function Script:... because it is a global function System:Print("See "..tostring(entity:GetKeyValue("name"))) end Quote Link to comment Share on other sites More sharing options...
TEPA6ANT Posted February 17, 2019 Author Share Posted February 17, 2019 2 minutes ago, Slastraf said: Call needs to be a global function. So far you have Call in the Script as a local function. To make it global paste it in main.lua , maybe somewhere at the top : function Call(entity,extra) --not use function Script:... because it is a global function System:Print("See "..tostring(entity:GetKeyValue("name"))) end Thanks.It helped. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.