playMaker

Author Topic: Ending a collision Event...  (Read 2596 times)

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Ending a collision Event...
« on: February 26, 2013, 09:13:49 AM »
Im making some simple AI, character wanders about till he hits a wall, (or invisible collider) All are tagged COLLIDER.
I use Collision Event and with the character controller, only On controller Collider Hit seems to work.
So I transitin to a rotate event and turn the NPC 180 degrees, but then the NPC continues to rotate, or at lease gets stuck on this action when its NOT colliding, How do I Reset this action when I can use On collision Exit?

SimonMillard

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Ending a collision Event...
« Reply #1 on: February 27, 2013, 05:37:00 AM »
You could probably make the transition from your rotate state back to your initial state happen with the OnCollisionExit event. This way your character will not be able to reenter the rotate state until he has exited the collision I guess? You could also move your character a little away from the wall as well as rotating it when the collision happens.

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Re: Ending a collision Event...
« Reply #2 on: February 27, 2013, 05:59:46 AM »
Thanks for the reply..

I tried using OnCollisionExit, with no result... CAn someone explain the use of the OnControllerColliderHit option? COs thats the only one that seems to work for me (when attached to a character collider) And that one doesnt haver a coresponding NOT HIT option...

On your second point, when he rotates (that IS working) he often moves away from the collider so hes not hitting it, but still wont leave the state, so continues to turn... OR walks in a straight line till he hits another collider, in which case it doesnt fire now... and he carrys on walking into the wall..

M

SimonMillard

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Ending a collision Event...
« Reply #3 on: February 27, 2013, 07:39:45 AM »
Could it be that your Rotate action has "Every Frame" set to true? Since you only want this to happen once you should set it to false.

Then you can probably just exit the state using the FINISHED event.