Jump to content

babylon rotate mesh on local axis


Gheatza
 Share

Recommended Posts

Hi,

 

I am new to babylon, and after a few days of struggling with rotations, I really need your help.

 

Basically I need to rotate an aircraft in 3D space.

In babylon I tried myMesh.rotation = new BABYLON.Vector3(rotationX, rotationY,rotationZ) but this rotates the aircraft around global axis and it is not what I want.

 

What I need is to rotate the aircraft around global Y axis, then rotate around local X and Z axis.

This is the Actionscript code I have used in a similar game:

 

matrix3D.identity(); 
matrix3D.appendRotation(currYaw, Vector3D.Y_AXIS);
 
//Get the new local Z and X vectors
matrix3D.copyColumnTo(2, fwdVec);
matrix3D.copyColumnTo(0, rightVec);
 
//Rotate around local Z and X axis
matrix3D.appendRotation(currRoll, fwdVec);
matrix3D.appendRotation(currPitch, rightVec);

 

I was not able to find the babylon APIs that I could use to get the same results. I find a lot of posts on babylon that use APIs that are not present in the latest babylon version.

Could someone please help me?

Thank you

 

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