No announcement yet.

Affect Local Rotation by World Axis

  • Filter
  • Time
  • Show
Clear All
new posts

    Affect Local Rotation by World Axis

    Hi, I am attempting to rotate an actor's local rotation given the global world rotation. We are interfacing with three different coordinate spaces (trackers, HMD, and UE4) and the trackers only provide world rotation relative the IR sensors in our room, I would like for that to affect our actor. For Example: the weapon currently rotates different axis depending the direction you are facing because if you face World +X and rotate; it matches the local axis so the rotation is fine. But if you face World +Y and rotate, the X and Y axis are flipped because if you do the same rotation as facing +X it will be +Y World and that affects the local actor's +Y which is a different rotation as local +X. When facing World X, and you Rotate Local +X, they match. When facing World +Y and you Rotate Local +X, the Local +Y rotates.
    I apologize if this is confusing I can clear it up if need be.
    I want to keep the same rotation no matter the world direction facing but given world rotation. So facing +Y, Rotate Local +X, The rotation received will be +Y, but local will rotate +X.
    Thank you.
    Last edited by PJn1nja; 10-21-2019, 12:33 PM. Reason: added tags

    For this you're going to want to get acquainted with Transform Rotation and Inverse Transform Rotation.

    This will allow you to convert a component's transform from local to world space and vice-versa (inverse). Without seeing a blueprint I can't tell you what you should do exactly, but this is the node you want.
    iTween For UE4
    Procedural pathed animation for actors, components & UMG - $0
    Runtime DataTable
    DataTables dynamically loaded from text or Google Sheets while your game is running!
    Fast, cheap, and accurate CSV parsing at runtime!