playMaker

Author Topic: Get Rotation Float  (Read 11433 times)

vonpopov

  • Junior Playmaker
  • **
  • Posts: 98
Get Rotation Float
« on: February 02, 2014, 08:10:02 AM »
Hi,

When i use the action Get Rotation and store the data into a Float Variable, i am not satisfied with what i get :

Here is an explicating image of what i expect :
(Value in blank are value stored into the Get Rotation Float)

http://oi60.tinypic.com/2u47up1.jpg

Is there someone who know how to get it like that ?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Get Rotation Float
« Reply #1 on: February 02, 2014, 09:57:23 AM »
 I'm quite sure you don't have the left image occurring, since 360 is a full rotation its not going to occur at the 180 position.

You should probably use quaternions, but you can use a couple of states to figure out which direction is in and subtract a number from it to get the value that you want. I did this once and its kind of overkill, but does work.

Look around for gimbal lock threads. On my phone atm so i cant really search.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

vonpopov

  • Junior Playmaker
  • **
  • Posts: 98
Re: Get Rotation Float
« Reply #2 on: February 02, 2014, 10:02:08 AM »
I'm quite sure you don't have the left image occurring, since 360 is a full rotation its not going to occur at the 180 position.

And this is exactly what i get , unfortunatly ... that is no sens, but it is what i get ...

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Get Rotation Float
« Reply #3 on: February 02, 2014, 10:13:37 AM »
 Can you post a repro scene package?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

vonpopov

  • Junior Playmaker
  • **
  • Posts: 98
Re: Get Rotation Float
« Reply #4 on: February 02, 2014, 11:36:35 AM »
yes





So, basically what i just did, is to get rotation from an object (throught a get axis vector).

What i want is to know "the local degree of orientation" of my object. But actually this not go 0° to 360°, it go 360 to 270, 270 to 360, then 360 to 90, 90 to 360 (this is what is see in the inspector variable)

o__o'

help :D

vonpopov

  • Junior Playmaker
  • **
  • Posts: 98
Re: Get Rotation Float
« Reply #5 on: February 02, 2014, 01:39:48 PM »
what is very strange, this is when i do the same test on X_Rotation (or Y_Rotation), everything fine, it goes 0 to 360 ..... but NOT with the Z axis ... what the hell is going on ?!

 :-\

vonpopov

  • Junior Playmaker
  • **
  • Posts: 98
Re: Get Rotation Float
« Reply #6 on: February 02, 2014, 02:03:11 PM »
I maybe have an idea of the problem.

Because Y and Z are ok, not Z, i supposed the problem come from another action.

The first on the list is the Get Axis Vector.
I just realize that my object is relative to "nothing".

On most of your tutorial this is relative to the main camera. mmmm ? any idea ?


Because of course i tryed, with the father of my main camera as relative. But , rotations breaks when i hit 270° or 90°. I am close to the problem , that is sure ... even if the camera is the children of my object, the axis (horizontal/vertical) change depending on Y axis orientation. this is .. adzjklaz jk adz jkad !  :-[



« Last Edit: February 02, 2014, 02:28:49 PM by vonpopov »

vonpopov

  • Junior Playmaker
  • **
  • Posts: 98
Re: Get Rotation Float
« Reply #7 on: February 02, 2014, 05:05:01 PM »
I am stuck.

I have no idea why , when i use "Get rotation", it gives me incorrect data on X (Y and Z axis are OK, and goes 0° to 360°), EVEN IF , my object is rotating perfectly in the 3D view.

I assume this is because i did something wrong between get axis, and rotating, BUT BUT BUT BUT , "Get rotation" shouldn't care ? no ? get rotation is just supposed to tell me what is the rotation of my object in the world ? and assuming the object is turning perfectly well, why the data in the X_Rotation float variable are crazy ? ...

 :-[ :-[ :-[ :-[ :-[ :-[ :-[ :'( :'( :'( :'(

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Get Rotation Float
« Reply #8 on: February 02, 2014, 05:53:12 PM »
Can you attach a scene so I can see whats going on?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

vonpopov

  • Junior Playmaker
  • **
  • Posts: 98
Re: Get Rotation Float
« Reply #9 on: February 02, 2014, 06:00:38 PM »
Can you attach a scene so I can see whats going on?

i am not sure how to do this :s
(maybe we could catch on skype ? and share my desktop ?)

I tryed to store the euler information from my object ... and i get something very weird.




As you can see, it seems Y and Z axis reverse to 180° with no reason when i hit 270° (same when i hit 90°). it could explain why X axis rotatin looks good in 3Dview even if the variable value looks crazy.


Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Get Rotation Float
« Reply #10 on: February 02, 2014, 06:04:00 PM »
Assets>Export Package, then choose the relevant scene/parts. Don't include PlayMaker in the package. That'll export the package into a file, which you can attach here.

I can't really tell whats happening from the pics, looking at the scene myself would help.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

vonpopov

  • Junior Playmaker
  • **
  • Posts: 98
Re: Get Rotation Float
« Reply #11 on: February 03, 2014, 04:13:50 AM »
Yes ok,

but before doing this, i am asking to myself if i did something wrong with my world orientation.

My vehicle local axis are oriented like this :

Z : Forward
Y : Top
X : on the right

And, my vehicle is oriented on the world the same way


What do you think ?


vonpopov

  • Junior Playmaker
  • **
  • Posts: 98
Re: Get Rotation Float
« Reply #12 on: February 03, 2014, 05:47:21 AM »
After some research, it seems this is not because of my local axis orientation (those are ok), and not because of my input modification.

Should it be because "get rotation" is not capable of getting the X axis correctly ?

Fact is , "Get Rotation" understand things like this :

X:180;y:0;z:0    =   X:0 ; y:180 ; z;180   

« Last Edit: February 03, 2014, 05:49:18 AM by vonpopov »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Get Rotation Float
« Reply #13 on: February 03, 2014, 06:31:02 AM »
Hi,

 I agree with Lane, you need to use quaternion, you are facing gimbal lock issues, you can't express reliably a rotation using euler angles, they are good for a very large number of needs, but not for everything.

 store your rotation as a quaternion and then extract what you need form there.

there is also a set of custom action that you will likely find useful to work with quaternions.

https://hutonggames.fogbugz.com/default.asp?W967


The question really is what do you want this value to be? what does that represent actually?


bye,

 Jean

vonpopov

  • Junior Playmaker
  • **
  • Posts: 98
Re: Get Rotation Float
« Reply #14 on: February 03, 2014, 07:14:19 AM »
you both are godamn, right. This is all about quaternion and gimball lock.

I just watched a 8 minutes movies on youtube, but as english is not my native language, i missed a lot of things, and not understand everything even if i understood this was clearly my problem.

I imported the quarternion package (also i don't understand why this is not already included into the playmaker package), and tryed some action.

But i am f**** lost ahah. I have no idea what to do with. All i know, is :

X and Z are my Horizontal and Vertical and i want them to rotate freely. (+ Z is my forward).

So i guess, i need to tell quarternion to LOCK Z and Y when X get to 270° and 90°. Is there any playmaker tutorial in that way ?

Thanks you for your support both :)