playMaker

Author Topic: How to get vector3 direction from an angle ? [SOLVED]  (Read 2462 times)

utopien

  • Playmaker Newbie
  • *
  • Posts: 37
How to get vector3 direction from an angle ? [SOLVED]
« on: January 12, 2018, 02:50:52 AM »
Hi I need your help my  problem is.  I do not know how to get a direction to put on the smooth look at Direction action  from my angle

have a character for a platformer game which I choose this move look at Direction so the character can move forward and backward and I fire a raycast two floor to get the normal of the ground in the vector 3 operator I get my angle with the normal  from the ground and vector up 0.1.0 the problem I want my character to align himself with the normal of the floor the problem is I do not know how to get a direction to put on the smooth look at Direction from my angle
. Thanks a lot for any help
« Last Edit: February 01, 2018, 01:10:53 AM by jeanfabre »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: How to get vector3 direction from an angle ?
« Reply #1 on: January 12, 2018, 04:21:42 AM »
Hi.
I am not sure what you mean.

But if you want to look to where you raycasted you can use the position.
and turn on 'keep vertical' and set your up vector.

But maybe this is not the best way to do, depending on your project.

Is the platformer 2.5 (side scroller) or top view or something else?

utopien

  • Playmaker Newbie
  • *
  • Posts: 37
Re: How to get vector3 direction from an angle ?
« Reply #2 on: January 12, 2018, 08:55:25 AM »
First i want to thanks you ! yes the project is 2.5  but i think i found a  solution i take ne normal ground and set v3 value and invert x & y of normal v3 value that give me the perpendicular to ground  then i  invert the forward value depending on the left or the right direction what iam was simply tring to do is make player orient in same way then the ground.


utopien

  • Playmaker Newbie
  • *
  • Posts: 37
Re: How to get vector3 direction from an angle ?
« Reply #3 on: January 12, 2018, 09:07:47 AM »
One Las questrion when my player face left or right  when he turn to oposite direction  some he do it facing -z and some opposite positive z  axis do have any iddee about how i can force him to trans on positive Z ???

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: How to get vector3 direction from an angle ?
« Reply #4 on: January 12, 2018, 10:26:06 AM »
Hi.
Does the player only need to face left/right? or does it also needs to look up/down.

If only face left/right maybe you can just compare the raycast x position vs the players x position then if raycast x is greater, face right
and if less, face left

utopien

  • Playmaker Newbie
  • *
  • Posts: 37
Re: How to get vector3 direction from an angle ?
« Reply #5 on: January 13, 2018, 05:09:06 AM »
That is perfect Thankyou !
Djaydino