Jump to content

how to disable the child meshes movement


vahith
 Share

Recommended Posts

hi all, i am creating multiple meshes with parent and child relationship. Here my question is when i move the parent its corresponding child is moving nicely, but when i trying move the child it moving independently, but what  i need is i want to disable the child movement or parent also move with child.. kindly suggest me how to do this

thanks
vahi

Link to comment
Share on other sites

Hi Vahith,

 

this is the correct behaviour of child-parent meshes. If you don't want to move the child independently, you would need to move its parent instead. so, instead of setting mesh.position , set mesh.parent.position (or better, use the mesh.parent.translate function).

I am not sure if there is a "disable" mechanism for positioning, you will just have to pay attention to the parent-child relationship. maybe something like this:

var newPosition = new Vector3(...)if(mesh.parent) {    mesh.parent.position = newPosition;} else {    mesh.position = newPosition;}

?

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