Data Realms Fan Forums
http://45.55.195.193/

Colliding
http://45.55.195.193/viewtopic.php?f=73&t=15865
Page 1 of 1

Author:  Mind [ Wed Jul 15, 2009 12:43 am ]
Post subject:  Colliding

Is there any way to use colliding in an if statement, like "if the particle collides with something" rather than using a distance to simluate it?

Author:  mail2345 [ Wed Jul 15, 2009 1:06 am ]
Post subject:  Re: Colliding

CastMOs.

Author:  Grif [ Wed Jul 15, 2009 2:30 am ]
Post subject:  Re: Colliding

Or use box-based hitboxes, but they're for obvious reasons less precise.

Kyred was doing something with boundingboxes, those would work better if you could do a within boundingbox check.

Author:  piipu [ Wed Jul 15, 2009 9:42 am ]
Post subject:  Re: Colliding

Code:
i = SceneMan:CastMORay(self.Pos,self.Vel,0,0,false,5)
self.thingie = MovableMan:GetMOFromID(i)
if self.thingie ~= nil then
  --stuff
end
Is what you're after. The collided object can be accessed with self.thingie if something was collided.

Author:  mail2345 [ Wed Jul 15, 2009 8:07 pm ]
Post subject:  Re: Colliding

Get the root MO, btw.
So it'e more like:
Code:
i = SceneMan:CastMORay(self.Pos,self.Vel,0,0,false,5)
if i ~= 255 then
self.thingie = MovableMan:GetMOFromID(MovableMan:GetMOFromID(i).RootID)
  --stuff
end

Author:  Mind [ Wed Jul 15, 2009 8:18 pm ]
Post subject:  Re: Colliding

Can you do "if it collides with an actor"?

Author:  mail2345 [ Wed Jul 15, 2009 8:33 pm ]
Post subject:  Re: Colliding

Code:
if self.thinge:IsActor() then
..
end

Done. Works even if it doesn't hit the torso.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/