I have a jsfiddle below. It has a parent plane geometry mesh to which I have added 2 plane geometries mesh’s as children. So, when the parent rotates the child too rotates as expected.
Now, the next thing I needed to do is to keep the child’s orientation the same( no rotation) even if the parent rotates. (But do change their position accordingly) Analogy to this similar to the Ferris wheel rotating but the individual cars remaining with the same orientation (Upright).
Is there a way do this by blocking the child’s rotation in the render loop? This has to be efficient since there could be more than 10000 children per PlaneGeometry mesh’s parent. I cant think of a way to do this at the moment.
Any help would be appreciated.
In this case, it’s probably best to remove the parent-child relationship. It’s the primary purpose of it to inherit 3D transformations to descendents.
I understand your point about not having the parent-child relationship. But the relationship is there because other because I want the children’s position to keep up with its parent. Maybe I framed the question wrong. Its more like the child box orientation has to be the same even if its rotating along with its parent. i.e Always horizontal.
Is there way to do this by still keeping the parent-child relationship intact ?
It’s actually easier to remove the parent-child relationship and keep the positions in sync with this approach:
Another options is to constantly use Object3D.lookAt() on your childs but this approach tends to be computationally more expensive than the other approach.
I really appreciate your prompt reply. Ill try these approaches and let you know if it worked for me.
I tried the approach mentioned above in the stack overflow link and changed my jsfiddle accordingly.
But when I take the matrixworld from the parent’s children I think the value is identity because of which both the child planes are getting their position reset to the origin.
Am I doing something wrong here ?