Hagop Posted February 8, 2017 Share Posted February 8, 2017 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. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 8, 2017 Share Posted February 8, 2017 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) Quote Link to comment Share on other sites More sharing options...
Hagop Posted February 8, 2017 Author Share Posted February 8, 2017 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) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 10, 2017 Share Posted February 10, 2017 You are right it is the same as parenting a mesh to a mesh. Just update child.position and child.rotation. It should just work. If not please provide an PG:) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.