Jump to content

How to get each entity in aabb


Slastraf
 Share

Recommended Posts

I made an aabb infront of the camera to check what could be in front of it, but I cant figure out how to do this in lua.

so far I have this:

if window:KeyHit(Key.Q) then
	local spellPointMin = Transform:Point(-2,-2,0,self.camera,nil)
	local spellPointMax= Transform:Point(2,2,5,self.camera,nil)
	local aabb = AABB(spellPointMin, spellPointMax)
	world:ForEachEntityInAABBDo(aabb,"PushSelf") 
end

the vectors for the aabb are fine, but the code snippet does not work as expected.

I have a function PushSelf on an object inside the aabb box. I guess you cant use it like this ?

 

Ah I understood that the parameter is a global function, and entity is the collided object.

  • Upvote 1
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...