playMaker

Author Topic: Get Rotation Float  (Read 11419 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Get Rotation Float
« Reply #15 on: February 03, 2014, 07:23:39 AM »
Hi,

 The question is , what do you want to do with this value? what does that mean in your project?

You can't lock axis with quaternions... also, you can't have two freely rotating axis without all axis being free... It's either a pivot around one axis or a totally free rotating body.


bye,

 Jean

vonpopov

  • Junior Playmaker
  • **
  • Posts: 98
Re: Get Rotation Float
« Reply #16 on: February 03, 2014, 07:43:26 AM »
Hi,

 The question is , what do you want to do with this value? what does that mean in your project?

You can't lock axis with quaternions... also, you can't have two freely rotating axis without all axis being free... It's either a pivot around one axis or a totally free rotating body.


bye,

 Jean


I am working with a plane controller. Actually this perfectly works in 3D view, but as i wanted to add some more effect, i saw my data on certain axis were "not" the way i needed to go further. More, the following camera was occuring problem when i hit verticals 90° or 270° (when doing a looping up or down).

So i realized, that my X axis (which represent the axis in order the plane do a looping) didn't go 0° (start position) to 360° (full looping). My X axis was going crazy when hit x:270, because  Y and Z get to 180 instantaneously.


look here :



This is what i don't want. I want X to go throught 270 and Y+Z not doing anything.

:)

tips : i am sur it has to do with "quaternion euler" action
« Last Edit: February 03, 2014, 10:45:34 AM by vonpopov »

vonpopov

  • Junior Playmaker
  • **
  • Posts: 98
Re: Get Rotation Float
« Reply #17 on: February 03, 2014, 11:02:38 AM »
i got a look on other topic in the forum about gimball lock, quaternion. But (even if i barrely not understand because i am definitively a designer and math are out of my mind)

here is what i am doing (if i remove all the rest):



Get vector, increment +3 , or decrement -3.
How is that possible that everything gone wrong for X when hit 270° and 90° ? shouldn't it be supposed to rotate the same way than Y and Z ? I mean just adding 3 or substracting 3 ... nope ?

 

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Get Rotation Float
« Reply #18 on: February 03, 2014, 11:18:41 AM »
That should rotate the object just fine, without gimbal lock.
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 #19 on: February 03, 2014, 11:30:33 AM »
That should rotate the object just fine, without gimbal lock.

i did a video, you'll see i am not crazy, it didn't work.

http://www.ww2airsoft.fr/popov/playmaker.mp4
(take a look at the quaternion value i register, which is the same as euler by the way. At first i was just monitoring X as float, and did not understand why those crazy value, until i catch Y and Z axis doing 180° for no reason)




More , if i chose to modify the Get axis vector with a "relative to camera" (camera children of the aircraft), then ... x rotation litteraly BLOCK at 270° (up) , or 90° (down).


And as you can see the aircraft is turning perfectly in the 3D view, but in fact at a time eye cannot catch, it flip 180° on Y and Z , so ... it makes it impossible to use correctly for the next steps of my project, i need a proper X rotation 0 to 360 (that i should have basically).


48h stuck on that dklajzdalzdjadjaza ! god i miss my pencils ahah "HELP"
« Last Edit: February 03, 2014, 11:43:00 AM by vonpopov »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Get Rotation Float
« Reply #20 on: February 03, 2014, 11:43:41 AM »
At first i was just monitoring X as float, and did not understand why those crazy value, until i catch Y and Z axis doing 180° for no reason)

There's nothing incorrect in those values, that is simply a correct rotation.

Quote
More , if i chose to modify the Get axis vector with a "relative to camera" (camera children of the aircraft), then ... x rotation litteraly BLOCK at 270° (up) , or 90° (down).

If your camera is the child of the object you're moving relative to your camera then that could be a problem. You have a dependency loop.

Quote
And as you can see the aircraft is turning perfectly in the 3D view, but in fact at a time eye cannot catch, it flip 180° on Y and Z , so ... it makes it impossible to use correctly for the next steps of my project, i need a proper X rotation 0 to 360 (that i should have basically).

What does this break, specifically? Rotations are always represented this way at a root level so the question is really how to identify what function you have that is broken by this and find a way around it. That generally just means using Quaternions instead of Euler angles.
« Last Edit: February 03, 2014, 11:46:04 AM by Lane »
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 #21 on: February 03, 2014, 11:58:12 AM »
ooooooow .... ok ok.
So, 48h going crazy for nothing, because that flip on Y/Z is normal representation ?

But why when rotating only Z or Y , i get a perfect 0° to 360° ?


You ask for what kind of function it breaks, ok the first one is :
07 - First and Third Person Cameras tutorial.

I did it, the camera follow perfectly, zoom in/out very well, but when i am doing a 360 turn on X, at the verticals, the camera get crazy (because of the itween rotate update as a delay it show obviously the problem of camera having trouble to know where it should be positionned during half a second).

:s


nb : again, thanks for you help :) :)



Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Get Rotation Float
« Reply #22 on: February 03, 2014, 12:11:17 PM »
Try using Late Update.

Since the tutorial is built around a much more simplistic environment and you're looking for complete rotational flexibility in any direction you will probably need to cater and customize your stuff to suit your specific application.
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 #23 on: February 03, 2014, 12:17:06 PM »
Try using Late Update.

Since the tutorial is built around a much more simplistic environment and you're looking for complete rotational flexibility in any direction you will probably need to cater and customize your stuff to suit your specific application.

i tryed late update, unfortunatly, no changes.

But i get it. I see what you mean. Could you point me a random playmaker asset (i found barrely nothing on the forum about quaternion) using Quaternion ? or some tutorial ? because the page with the quaternion action is not that easy to my comprehension. (https://hutonggames.fogbugz.com/default.asp?W967)

I am not sure to understand how it works. To me, this is a way to "detect" some angle combinaison, and "act" on that angle in real time. But i am not sure to understand.

I would try to improve the camera (from that tutorial) with quaternion in order to avoid the actual glitchs. Maybe detecting when the rotation hit 270° / 90° and tell the camera what to do.

But as i am not sure from what to start, if could point me some clues, or action set that would be usefull it could be a great start to me.

thanks

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Get Rotation Float
« Reply #24 on: February 03, 2014, 12:34:02 PM »
Quote
i tryed late update, unfortunatly, no changes.

worth a try ;)

Quote
But i get it. I see what you mean. Could you point me a random playmaker asset (i found barrely nothing on the forum about quaternion) using Quaternion ? or some tutorial ? because the page with the quaternion action is not that easy to my comprehension. (https://hutonggames.fogbugz.com/default.asp?W967)

You're not alone in this boat! There isn't much info on learning quaterion use, I got a vague idea of how they work by studying the Unity Scripting Reference, looking at gimbal lock threads on the Answers page and just experimenting.

Quote
I am not sure to understand how it works. To me, this is a way to "detect" some angle combinaison, and "act" on that angle in real time. But i am not sure to understand.

I would try to improve the camera (from that tutorial) with quaternion in order to avoid the actual glitchs. Maybe detecting when the rotation hit 270° / 90° and tell the camera what to do.

The problem you're seeing is coming from setting the rotation explicitly. If you do something intuitive like a Look At + Move Towards thing with some balancing involved then you will not see the glitch, Unity will just interpolate the rotations properly because its not required to force specific rotational values in, generic and unrelated to the rotation. I intended to do this at some point but ended up going with a full First Person view. There are some free Following scripts available in various kits that you may be able to derive some ideas from their code.

Personally, I avoided this in Brevis flight by using Physics and adding force so I don't have any concerns about the angles or rotations. If you're in atmosphere then you can get the position/rotation wrt world for an up angle. I had a gyro done by just setting the rotation to 0,0,0 per frame wrt World... Ship moves - gyro inside stays level. Little tricks like that are a facade to reality that saves you a lot of time figuring out more complex stuff.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Get Rotation Float
« Reply #25 on: February 05, 2014, 04:57:03 AM »
Hi,

 Sorry, I can't make sense of this. what behavior do you want to achieve?

bye,

 Jean

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Get Rotation Float
« Reply #26 on: February 05, 2014, 06:45:46 AM »
Hi,

 Sorry, I can't make sense of this. what behavior do you want to achieve?

bye,

 Jean

It looks like he wants to rely on rotation to return an angle for some things, but at some point Unity will sometimes arbitrarily change or invert axi during a rotation and even though they're correct it will cause glitches.

At least thats what it looks like to me.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Get Rotation Float
« Reply #27 on: February 06, 2014, 06:22:58 AM »
Hi,

 Yep, but what I don't get is the finality of that need. I need to know what the actual behavior is and then I can provide a working sample or something.

Is it for example to control a spacecraft by rotating the gameobject on two axis? is it to aim at something like a turret? etc etc

bye,

 Jean