Hi Guys, How can I make universal camera as the child of a mesh so that which ever direction mesh is rotating the camera would also rotate
Just doing camera.parent = yourmesh
should work.
Hi thanks for the quick reply. actually I made camera as child of root mesh of a glb model
camera.parent = meshes[0]. But the issue was that, entire scene was actually mirrored
Yup. Quite normal. mesh[0] from a glb (or gltf) import is the β_root_β node. This node is a root/parent created on import to conform right-handed system to the left-handed BJS standard. Anything you will add in BJS to this node will also get the transformation (a minus Z-axis and Math.PI on Y).
Two solutions here_:
- Use the right-handed system in your scene.
- Unparent from this root node, eventually parent to a new one⦠then parent your cam to the new node.
2 Likes
Thanks a lot. That was a life saving information