playMaker

Author Topic: Transform local quaternion to global  (Read 263 times)

Mupp

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Transform local quaternion to global
« on: January 17, 2021, 10:47:59 AM »
How can I transform a local quaternion variable to global?

Mupp

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Re: Transform local quaternion to global
« Reply #1 on: January 20, 2021, 07:35:47 PM »
bump

Mupp

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Re: Transform local quaternion to global
« Reply #2 on: January 24, 2021, 02:54:14 PM »
bump again

Didn't think this was such an odd question.

nuFF3

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 74
  • Are we even real?
    • View Profile
    • One Month Studio
Re: Transform local quaternion to global
« Reply #3 on: January 24, 2021, 05:33:30 PM »
You know how to use google don't you?
If not -> http://letmegooglethat.com/?q=unity+quaternion+local+to+world
Literally one of the first results:
https://forum.unity.com/threads/how-to-i-convert-a-local-rotation-to-a-global-rotation-for-the-object.470309/
https://answers.unity.com/questions/301085/transform-global-quaternion-from-local-quaternion.html

You apply these principles to playmaker and 'hey presto', you've got what you wanted.
No need to bump, just learn to research.

Mupp

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Re: Transform local quaternion to global
« Reply #4 on: January 24, 2021, 08:05:38 PM »
Yes, I've read those too, since I actually searched before posting.

The problem is that I can't figure out how to do the maths on a "quaterninon variable". I can't find an action that converts it to a vector3 so I can use the math actions in Playmaker. If this is possible it's not obvious to me.

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 215
    • View Profile
Re: Transform local quaternion to global
« Reply #5 on: January 25, 2021, 01:22:41 AM »
You can convert a Quaternion to a Vector3 by using the "Get Quaternion Euler Angles" action that's included with PlayMaker.

I believe you should also be able to get the world rotation by using another object's rotation as an offset. Most commonly the parent object's rotation.

"Get Rotation" to get the world rotation of the parent as a quaternion.
"Get Quaternion Multiplied by Quaternion" action to multiply your parent's rotation by your local rotation.

Quaternion worldRotation = transform.parent.rotation * localRotation;

Mupp

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Re: Transform local quaternion to global
« Reply #6 on: January 25, 2021, 02:42:13 PM »
Oh, I thought euler angles was something completely different, but it actually just converts it to a vector. Thanks.