playMaker

Author Topic: Point Object Towards Axis Vector  (Read 389 times)

mrhecker

  • Playmaker Newbie
  • *
  • Posts: 1
Point Object Towards Axis Vector
« on: December 16, 2022, 01:55:31 PM »
Hi all, I've been watching tutorials for pointing an object towards an input axis vector, but they all seem focused on top-down. When applying the same methods to a 2d platformer (for flying controls), the results change. I'm wondering if there's something else I should be doing.
Right now I'm using:

Get Axis Vector (up down left right wasd controls):
Horziontal Axis and Vertical Axis, Map to Plane XY, Store Vector "axisvector"

Translate (to move the player):
Vector "axisvector", Space "World"

Quaternion Look Rotation:
Direction "axisvector", Result "quatresult"

Set Rotation:
Quaternion "quatresult"
Y Angle "90" (objects are rotated 90 on the Y axis for the platformer setting)
Space "World"

And here's the result:

The object (cube) does point in the correct direction when flying right + up or down, but the problem is it doesn't when moving left.
I should also mention this is using Easy Character Movement's 2d settings, where the player object's Y axis is rotated by 90 degrees. I'm not sure if that's what's messing things up, but in the Playmaker states I set Y Angle in Set Rotation to 90 to compensate for it.
Also, ECM's character controller script is disabled during this state. The only active components are Capsule Collider, Rigidbody, and PlayMakerFSM.
« Last Edit: December 16, 2022, 01:58:59 PM by mrhecker »