Game Development Community

AI onCollision?

by Trevor Dahlke · in Torque Game Engine · 05/03/2007 (5:02 am) · 2 replies

Can anyone point me in the right direction here? I have a little ai guy running around and i want an effect to happen when he collides with the player. Any help would be appreciated.

About the author

Recent Threads


#1
05/03/2007 (6:24 am)
You can use this:
function YourAIDataBlockName::onCollision(%this, %obj, %col)
{
   if (%col.getClassName() $= "Player")
   {
      //Do your affect here
   }
}
There is a weird problem I have seen with collision. If I'm being chased and I'm running away, if I change direction and run toward him, I can run right through him. I hope this doesn't effect your onCollision stuff.
#2
05/03/2007 (8:43 am)
Oh wow that's pretty simple.
Thanks a lot for the help.