Hagop

Code for Parented mesh rotating around Free Camera

Recommended Posts

Dear all

Can somebody point out the code segment in the source code of BABYLON.js  or the commands that make a mesh parented to a FreeCamera rotate smoothly with the FreeCamera. The reason why I am asking this is because if I have a Physics impostor in the mesh and I parent it to the Free Camera, cannot control meshes position after parenting, so I am thinking of NOT parenting and rotating it manually.

Share this post


Link to post
Share on other sites

If the mesh is physics it is control by physic engine. So you cannot directly control it with parenting

Only way is to use things like:

impostor.setLinearVelocity(new BABYLON.Vector3(0,1,0));

or

impostor.setAngularVelocity(new BABYLON.Quaternion(0,1,0,0));

or

impostor.applyImpulse(new BABYLON.Vector3(10, 10, 0), sphere.getAbsolutePosition());

or

mesh. updatePhysicsBodyPosition (this one is useful if you change position of your mesh and you want to synchronize the impostor)

Share this post


Link to post
Share on other sites

Hi Delkatosh, thank you for the prompt reply. I just need the rotation logic/code for SIMPLE mesh (no physics applied) parented to camera (i guess it;s the same commands when parenting a mesh to another mesh) 

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.