playMaker

Author Topic: Get Rotation Problem [SOLVED]  (Read 2459 times)

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Get Rotation Problem [SOLVED]
« 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?
« Last Edit: February 08, 2020, 04:34:08 PM by krmko »
Available for Playmaker work

daniellogin

  • Full Member
  • ***
  • Posts: 215
Re: Get Rotation Problem
« Reply #1 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.

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Get Rotation Problem
« Reply #2 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.
« Last Edit: January 19, 2020, 11:01:05 AM by krmko »
Available for Playmaker work

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Get Rotation Problem
« Reply #3 on: January 19, 2020, 05:17:34 PM »
For example, two red cubes are rotated the same



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.



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?
« Last Edit: January 20, 2020, 02:29:14 AM by krmko »
Available for Playmaker work

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Get Rotation Problem
« Reply #4 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

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Get Rotation Problem
« Reply #5 on: February 02, 2020, 09:38:25 AM »
Hi Jean,

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


Available for Playmaker work

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Get Rotation Problem
« Reply #6 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

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Get Rotation Problem
« Reply #7 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



Let me know how it goes.

Bye,

 Jean

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Get Rotation Problem [SOLVED]
« Reply #8 on: February 08, 2020, 04:34:25 PM »
Works fine, cheers Jean, you're the best  :)
Available for Playmaker work