Jump to content

how to print current rotation angle?


ZeroAT
 Share

Recommended Posts

Is there any way to print the current rotation angle?

I am currently using the code below, but I only want it to rotate 180 degrees instead of 360 degrees. I think I need to compare values with MATH.PI, but I am not sure what the other value would be because I have no idea how to figure out the current angle of rotation.

 

As shown in the image below, I need to be able to retrieve x,y,and z to compare values. Any ideas on how to get these values?

 

BABYLON.SceneLoader.ImportMesh("",'', "ship.babylon", scene, function(newMeshes){
ship = newMeshes;
...
...
..

ship[0].rotate(BABYLON.Axis.Y, Math.PI / 2, BABYLON.Space.WORLD);

 

 

133.png

Link to comment
Share on other sites

Hi @ZeroAT and welcome to the forum. If you want to turn the ship 180 degrees from current position you can use .addRotation http://doc.babylonjs.com/babylon101/position#sequencing-rotations

If you want Euler Angles the you can convert from the quaternion http://doc.babylonjs.com/resources/rotation_conventions#quaternions-to-euler-angles

Hope this helps. Ask again if you need more help.

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...