ZeroAT

how to print current rotation angle?

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.