Parrenting a mesh without putting the child mesh on its origin and will still follow

Hi guys just want to ask. I’ve been making an Arrow game where you shoot characters then the arrow will get stuck on their body where I shotted. I put a mesh on the skeleton( theSkeletonMesh.parent = skeleton[13] ) after that I add an actionManager to the arrow where if it hits theSkeletonMesh the arrow will be its child( theArrow.parent = theSkeletonMesh ) it works fine and the arrow is now stuck in the body and follow the body is it lies in the ground however the arrow position in the global changed. I also tried Merge theSkeletonMesh and theArrow it works but the theSkeleton Mesh is no longer following the skeleton[13] so the enemy died but the arrow is still floating in the air not on the enemy body

Hi, I guess the arrow coordinates remain after parenting (relative to the new parent) if you simply use .parent.
Did you try the other methods setParent and addChild or transforming the coordinates of the arrow on parenting ?
Else, I believe this option from the doc/PG would probably apply here (transform child before and parent after):

1 Like

Yes I have tried. theArrow.setParent(bone) it worked but the arrow is hanging in the air it did not follow the bone to the ground when the enemy dies. When I used the arrow.parent = bone it will follow the bone because it is now its parent however my problem here it the direction of the arrow changed and its scale example I hit the enemy in front when my arrow hits my target arrow.parent = bone my arrow position will be relocated to the bone origin position

Have you tried using the attachToBone method on the arrow mesh?

still did not work :frowning:

1 Like

I am having problem with mesh.lookAt… It works fine if the mesh has no parent and I do this mesh.lookAt(my character position). However, if I set the mesh.parent = skeleton[3] and do mesh.lookAt again the mesh will no longer look directly to me it will lookat somewhere else please help me

Is that anyhow related to your arrow issue or something else?
At this point, any chance you can reproduce your issue in a PG? Even without the real model.

1 Like

Yes this is realated to the arrow. If the arrow hits the target ( arrow.parent = target) the arrow position then will change it will copy the target position so the arrow will not look like it hits. so what I thought that after hitting the target and the arrow will change its position the rotation will change so I will arrow.lookAt to the place where it came from

A playground repro would be VERY helpful here