Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: createasaurus on September 24, 2014, 12:13:41 PM

Title: How do you trigger a No Hit Event for when raycast hits nothing? [solved]
Post by: createasaurus on September 24, 2014, 12:13:41 PM
I am making an enemy player AI.  I want him to stop when he reaches a cliff that is too high.

I put a raycast with -1 on Y (pointing down) and set the distance to 1.5.  My hope was that the raycast would constantly hit the terrain mesh.  Then when the terrain mesh dropped out by more than 1.5... BAM - it would trigger a No Hit Event for full stop.  Unfortunately, I do not see a No Hit Event in the raycast action.  Is there a way to do this, or is there a different approach to this problem that you could recommend?

Thank you very much,
Createasaurus
Title: Re: How do you trigger a No Hit Event for when raycast hits nothing?
Post by: createasaurus on September 24, 2014, 12:53:46 PM
Hmmm... maybe if I look into the Store Hit Distance.... and check if the distance is greater then X...  I going to be experimenting along these lines next.
Title: Re: How do you trigger a No Hit Event for when raycast hits nothing?
Post by: terri on September 24, 2014, 01:06:06 PM
or you could also store collider info and do a check on that
Title: Re: How do you trigger a No Hit Event for when raycast hits nothing?
Post by: Lane on September 24, 2014, 01:31:05 PM
Try this action

http://hutonggames.com/playmakerforum/index.php?topic=5406.msg28956#msg28956

I didn't make a thread for it, never got around to polishing and finishing it but it should work.
Title: Re: How do you trigger a No Hit Event for when raycast hits nothing?
Post by: createasaurus on September 24, 2014, 02:38:08 PM
@Lane, there is a Raycast 2 custom action???!!!  NICE!!!
I have it loaded and will be testing out the No Hit Event.

@terri, Thanks I'll check this out if the custom action is a no go.
Title: Re: How do you trigger a No Hit Event for when raycast hits nothing?
Post by: createasaurus on September 24, 2014, 02:51:27 PM
Nice!  The Raycast 2 action's additional functionality has what I need.  I have a RayCast 2 pointing down at a 1.5 length.  It has a No Hit Event which fires off if there is no floor underneath at a distance of 1.5 or greater.  No more enemies blindly walking off cliffs!  Thank you.