Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Fat Pug Studio on January 18, 2020, 04:26:17 PM

Title: Get Rotation Problem [SOLVED]
Post by: Fat Pug Studio on January 18, 2020, 04:26:17 PM
Hi guys,

I'm doing some 3D for the first time, though i'm doing well there's something i can't figure out. I have an object that's not parented to anything and has rotation 0, 0, -15 set via transform in the inspector.

However, when i use Get Rotation to get its rotation i get something like -270, 0, 0. I tried self world, eulers, quaternions, tons of other actions, delaying the start and so on but i still can't get it the way it is displayed.

Any advice?
Title: Re: Get Rotation Problem
Post by: daniellogin on January 18, 2020, 10:45:02 PM
Hi guys,

I'm doing some 3D for the first time, though i'm doing well there's something i can't figure out. I have an object that's not parented to anything and has rotation 0, 0, -15 set via transform in the inspector.

However, when i use Get Rotation to get its rotation i get something like -270, 0, 0. I tried self world, eulers, quaternions, tons of other actions, delaying the start and so on but i still can't get it the way it is displayed.

Any advice?

Just for debug sake, what if you try doing a Set Rotation before you Get Rotation? See if they match. Also while you do it, note position it rotates to and see if anything can be figured out from that too.
Title: Re: Get Rotation Problem
Post by: Fat Pug Studio on January 19, 2020, 10:55:34 AM
I tried setting the rotation then getting it.

When using euler angles instead of 0, -20, -90 i get -5.12243e-05, 340, 270.
Title: Re: Get Rotation Problem
Post by: Fat Pug Studio on January 19, 2020, 05:17:34 PM
For example, two red cubes are rotated the same

(https://i.postimg.cc/13rghLQP/screenshot-14.png)

But one has 0, 0, -50 rotation, other has 140, 90, 90.

Whatever i choose, quaternion, euler, x, y, z, i can only get it right via gizmo. It's like it's missing one more axis.

(https://i.postimg.cc/KzR4Tjgv/screenshot-15.png)

The only thing is that the object that should rotate is scaled differently, it is elomgated to 2 via x. How to take that into account? Maybe get the direction?
Title: Re: Get Rotation Problem
Post by: jeanfabre on January 20, 2020, 09:58:20 AM
Hi,

can you show the two red cubes at an angle on the scene view with their respective transform tripod axis?

Bye,

 Jean
Title: Re: Get Rotation Problem
Post by: Fat Pug Studio on February 02, 2020, 09:38:25 AM
Hi Jean,

sorry for being a bit late. What'a s tripod axis?

(https://i.imgur.com/kNae01W.png)
(https://i.imgur.com/AjGBEqZ.png)
Title: Re: Get Rotation Problem
Post by: jeanfabre on February 03, 2020, 12:49:38 AM
Hi,

 this will explain it: https://forum.unity.com/threads/solved-how-to-get-rotation-value-that-is-in-the-inspector.460310/

basically, they tweaked the values shown to look nice....

the transform tripod axis is the blue,red green axis showing either the local transform reference system of the global reference system of a transform. It certainly has a better name... but that's how I call it :)

Bye,

 Jean
Title: Re: Get Rotation Problem
Post by: jeanfabre on February 03, 2020, 01:37:47 AM
Hi,

 ok, in that post, they had some code snippet and it seems to work so I made an action for it: GetTransformRotationInspectorEuler

(https://i.imgur.com/2UEwhLw.png)

Let me know how it goes.

Bye,

 Jean
Title: Re: Get Rotation Problem [SOLVED]
Post by: Fat Pug Studio on February 08, 2020, 04:34:25 PM
Works fine, cheers Jean, you're the best  :)