Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: PET on August 08, 2016, 05:43:30 AM

Title: Casting a Raycast on a particular state
Post by: PET on August 08, 2016, 05:43:30 AM
Hello there,

I have a cube that has multiple states. When it gets to a particular state I want to cast a Raycast from the Player and I want to check if the Player is looking at the Cube. If the Player looks at the cube do an event.

Any idea why this does not work?

(http://puu.sh/qtN9p/906e92aa8e.png)

I tried to even put the Raycast on the player itself to test this... I checked the Debug so I can see the Yellow line. No line :( so the Raycast does not work.

What am I doing wrong?

Thank You

P.S. I did a test with Mouse Pick Event and that one works.
Title: Re: Casting a Raycast on a particular state
Post by: 600 on August 08, 2016, 06:14:28 AM
 Hello,

in the screenshot there is no direction set, to shoot forward set it x 0; y 0; z 1
Title: Re: Casting a Raycast on a particular state
Post by: PET on August 08, 2016, 06:59:31 AM
Thanks man!

How do I check whether my object only hit's a particular object? If I look at the ground the Raycast will "hit" because I hit the Terrain Mesh Collider, and I only want this to check if it hits the Cube.

Thanks
Title: Re: Casting a Raycast on a particular state
Post by: 600 on August 08, 2016, 07:20:27 AM
I usually use Layer Mask option to raycast only specific layers, so you have to set the layer for that object you want to hit.
Title: Re: Casting a Raycast on a particular state
Post by: PET on August 08, 2016, 08:18:34 AM
Thanks for the help!