Jump to content

AABB not see entity


TEPA6ANT
 Share

Recommended Posts

-=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

Но при подходе любого другого объекта(например, игрок) к этому объекту, ничего не происходит. 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...