Jump to content

euler to quaternion rotation issue


satguru
 Share

Recommended Posts

changing rotation from quaternion to euler resets the mesh rotation

 

consider this

http://www.babylonjs-playground.com/#ZTNIZ

Here I am just rotating the cube by 45 degree around y axis. This works as expected.

 

Now  just convert  the rotation to euler 

http://www.babylonjs-playground.com/#ZTNIZ#1

And the cube goes back to its previous rotation !!

 

Link to comment
Share on other sites

I was playing  around with this a little more and found that if I set the quaternion rotation to null after I change the rotation to euler then the cube rotation is not reset 

see

http://www.babylonjs-playground.com/#ZTNIZ#2

So it looks like now, at any time the rotation can be either in euler or quaternion but not both. Right ?

 

Link to comment
Share on other sites

The rotationQuaternion has priority over the rotation property.
If rotationQuaternion is not null the rotation property is ignored. The rotate function of the mesh operates on rotationQuaternion.
I would recommend not to use the rotation property at all ... Or you should remember that you should never use rotationQuaternion or any function which operates on it.

In my opinion the rotation property should be removed. Instead some helper/utility functions could be added for people who want to work with euler angles.

Link to comment
Share on other sites

5 hours ago, satguru said:

So it looks like now, at any time the rotation can be either in euler or quaternion but not both. Right ?

Yes, it is or Euler or Quaternion.  Even 3ds max offers one or the other, but not both.

We must convert every time you need Euler => Quaternion and Quaternion=> Euler

Link to comment
Share on other sites

I guess having both could be confusing to the engine.

It probably makes sense to use one rather than both.

But I wonder about the new behavior of resetting the rotation, when both are used.

Is this by design or is the unintended consequence of some other change?

 

Link to comment
Share on other sites

@Deltakosh

Thats fine. I ran into this issue with my EditControl app. The edit control uses quaternion, but after rotation it  would also update the euler value  to sync it up with the quaternion value.I did this to make it convenient for the EditControl user in case they were using Euler. Going forward I will remove this and just add a note in the documentation. If the user wants to use euler then they can update the euler from the quaternion and set the quaternion to null.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...