playMaker

Author Topic: get local Rotation  (Read 4514 times)

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
get local Rotation
« on: August 19, 2017, 01:42:48 PM »
Looks like a simple question, but I stuck. How can I get the local rotation of the object like it is shown in the inspector? For example it rotates from -10 to 10, how can I just get this numbers, instead of all this eulerquaternionstuff
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: get local Rotation
« Reply #1 on: August 19, 2017, 10:51:52 PM »
Hi,
"Get Rotation" action?

Btw.
You should try to avoid using get/set property.

if you can't find certain action, there is a big list of actions on the Ecosystem :)

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
Re: get local Rotation
« Reply #2 on: August 20, 2017, 08:44:45 AM »
Is get/set property so bad?

But even with Get Rotation I can't obtain this result  :-\
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: get local Rotation
« Reply #3 on: August 20, 2017, 09:54:03 AM »
Hi,
i think you need to set 'Space' to "world"

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
Re: get local Rotation
« Reply #4 on: August 20, 2017, 11:18:41 AM »
No way.  "world" showing me the rotation relatively to the world, so it's inherit all the rotations from the parent objects and show 0..360 angle relatively world x-axis.

Self mode is correct, but  it can't give me -10 value (like it shown in the inspector), instead giving me 350.

And it's very frustrating, because I can't simply remap value (-10..10) in one action. It's jumping from the 0 to 360 and back.
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: get local Rotation
« Reply #5 on: August 20, 2017, 11:22:23 AM »
I actually had this same problem a bunch of months back (was working a small VR game). Let me take a look into it again now that my C# is a bit better.

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
Re: get local Rotation
« Reply #6 on: August 20, 2017, 11:30:07 AM »
Great, thanks! Looking forward to see your results!

I wonder, is it really not a common task, so there is no common solution out of the box?  ???
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
Re: get local Rotation
« Reply #7 on: August 20, 2017, 12:03:54 PM »
So, as I understand, basically people use solution like:
if (x > 180)   x -= 360;

Isn't it weird? I see the negative values right in the inspector with my eyes, why can't I just get it directly like it shown?  :o

And obviously I can't make it in one FSM state and need to make a networks of checks and transitions?
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
Re: get local Rotation
« Reply #8 on: August 20, 2017, 12:34:58 PM »
OK, I made my own action for negative values of local rotation. If someone else need it - here it is

https://www.dropbox.com/s/9zoeion5oh8m700/GetNegativeRotation.cs?dl=0
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: get local Rotation
« Reply #9 on: August 21, 2017, 01:16:32 AM »
No way.  "world" showing me the rotation relatively to the world, so it's inherit all the rotations from the parent objects and show 0..360 angle relatively world x-axis.

Self mode is correct, but  it can't give me -10 value (like it shown in the inspector), instead giving me 350.

And it's very frustrating, because I can't simply remap value (-10..10) in one action. It's jumping from the 0 to 360 and back.

Sorry, i did not check properly. (was working on 3 project @ the same time)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: get local Rotation
« Reply #10 on: August 21, 2017, 02:18:02 AM »
Hi,

 yes, the Transform component inspector is processing the euler angles, so getting the exacty same values means fiddling around. 350 is the right value, -10 is a processed value and it's not available form the transform rotation directly.

 Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: get local Rotation
« Reply #11 on: January 10, 2019, 03:53:20 AM »
Hi,

 I just put that action on the Ecosystem for convenience.

 Bye,

 Jean