How to prevent the movement of child without parent

In my script, I add box mesh . Then I added a sprite element for labeling the box. That label is attached with box as child . In that, the child is able to move individually without moving parent. I want to stop that. The child should be movable with the parent only not separately. How to do that?

Try attaching the label as child of the box instead. Unlike in real life, children follow their parents in three.js.

1 Like

Oh. So there is no way for stopping the independent movement of child. Right?

Actually, I need the movement of child only following the parent. Not independent move of child

If you don’t want it to move, don’t move it.

But I have placed the child in front of the object. So if I click and drag the object at the place of it’s child by mistake, the object won’t move. But the child will be moved.

I didn’t know you were talking about mouse click interaction. If so, I recommend that you add a boolean “clickable” property to your objects, and change clicked object to its parent until you get to a clickable one.

yes, that is a nice idea. I thought, there may be an inbuilt function or method to stop the independent move of child. So only I asked. Thank you

You should always take care to describe your problem clearly, preferably with a jsfiddle or other live demonstration. There are templates in the pinned post