View unanswered posts | View active topics It is currently Sat Apr 27, 2024 12:20 pm



Reply to topic  [ 7 posts ] 
 Colliding 
Author Message
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1359
Location: USA
Reply with quote
Post 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?


Wed Jul 15, 2009 12:43 am
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Colliding
CastMOs.


Wed Jul 15, 2009 1:06 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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.


Wed Jul 15, 2009 2:30 am
Profile
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post 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.


Wed Jul 15, 2009 9:42 am
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post 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


Wed Jul 15, 2009 8:07 pm
Profile
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1359
Location: USA
Reply with quote
Post Re: Colliding
Can you do "if it collides with an actor"?


Wed Jul 15, 2009 8:18 pm
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Colliding
Code:
if self.thinge:IsActor() then
..
end

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


Wed Jul 15, 2009 8:33 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.069s | 15 Queries | GZIP : Off ]