playMaker

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

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 1046
    • View Profile
    • Fat Pug Studio
Get Rotation Problem [SOLVED]
« on: January 18, 2020, 02: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, 02:34:08 PM by krmko »

daniellogin

  • Full Member
  • ***
  • Posts: 193
    • View Profile
Re: Get Rotation Problem
« Reply #1 on: January 18, 2020, 08: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.

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 1046
    • View Profile
    • Fat Pug Studio
Re: Get Rotation Problem
« Reply #2 on: January 19, 2020, 08: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, 09:01:05 AM by krmko »

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 1046
    • View Profile
    • Fat Pug Studio
Re: Get Rotation Problem
« Reply #3 on: January 19, 2020, 03: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, 12:29:14 AM by krmko »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14963
  • Official Playmaker Support
    • View Profile
Re: Get Rotation Problem
« Reply #4 on: January 20, 2020, 07: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

krmko

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

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



jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14963
  • Official Playmaker Support
    • View Profile
Re: Get Rotation Problem
« Reply #6 on: February 02, 2020, 10:49:38 PM »
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: 14963
  • Official Playmaker Support
    • View Profile
Re: Get Rotation Problem
« Reply #7 on: February 02, 2020, 11:37:47 PM »
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

krmko

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