playMaker

Author Topic: Raycast and compare facing direction [SOLVED]  (Read 1229 times)

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Raycast and compare facing direction [SOLVED]
« on: August 12, 2016, 09:39:12 AM »
Hi

I have a 3d game where the player moves one space at a time, the player at some point raycasts against a trigger which needs to compare its up vector to that of my players, then do an action. So if the player is upside own when approaching it will do one action, if the player is facing up to the trigger it will do another action etc.

Ive attached a screenshot with 2 examples of how i think i could achieve it, but im not sure what the best method is for this?

Nick
« Last Edit: August 15, 2016, 03:40:38 AM by coxy17 »

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Raycast and compare facing direction
« Reply #1 on: August 15, 2016, 03:40:21 AM »
I ended up solving this myself.

I used a raycast to detect when i hit the target as usual, then i used the game object it it and saved its Y axis (world). Then in a separate FSM on my player i got the Y axis (self) and compared it to the world space. This allowed me to then compare the target and my player and then do an action.