Jump to content

Code for Parented mesh rotating around Free Camera


Hagop
 Share

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.

Link to comment
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)

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