playMaker

Author Topic: Casting a Raycast on a particular state  (Read 1959 times)

PET

  • Full Member
  • ***
  • Posts: 139
    • GamerPET
Casting a Raycast on a particular state
« 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?



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.
Technical Game Designer
www.GamerPET.com

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 713
    • Flashing Lights
Re: Casting a Raycast on a particular state
« Reply #1 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

PET

  • Full Member
  • ***
  • Posts: 139
    • GamerPET
Re: Casting a Raycast on a particular state
« Reply #2 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
Technical Game Designer
www.GamerPET.com

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 713
    • Flashing Lights
Re: Casting a Raycast on a particular state
« Reply #3 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.

PET

  • Full Member
  • ***
  • Posts: 139
    • GamerPET
Re: Casting a Raycast on a particular state
« Reply #4 on: August 08, 2016, 08:18:34 AM »
Thanks for the help!
Technical Game Designer
www.GamerPET.com