Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: smiffy on April 08, 2019, 06:46:32 AM

Title: How do you detect only first object hit on a raycast?
Post by: smiffy on April 08, 2019, 06:46:32 AM
Hi there,

I'm trying to use raycast to place an object on the ground with some success, I have the object stepping up and down over ground objects. However if there are two objects on the ground, (ie a floor plane and a step) the object flickers between the two.

How do I get the raycast to stop at the first object it hits and ignore the one underneath?

Thanks, Matt.
Title: Re: How do you detect only first object hit on a raycast?
Post by: djaydino on April 09, 2019, 08:52:07 AM
Hi.
Can you show the issue in a video?
Title: Re: How do you detect only first object hit on a raycast?
Post by: Thore on April 09, 2019, 01:32:49 PM
A: Set the raycast to go to next state after it found something (do not use every frame). That might do the trick. The next state, you do the thing, then return to checking. If you need constant checks, you can also build a loop manually. Use two identical states with rays, and a wait action in each, plus finished events. You can also put the wait between them etc.