How do I make Physics Objects follow its Parent?

Is there a way to reparent a physics object? I would like to do a sort of grab a thing mechanic, so I want to reparent the object to the “hand”. If I change parent though the local transform is not updated to stay in the same place and the object snap into another position.

I can get the translation world and set it again and this fix the position, but not the rotation! Any help?

// init:
this.tempTransform = new Float32Array(8);

// where you need it:

/* Calculate what the new local transformation would be by "subtracting" the new parents transform from the current transformWorld */
glMatrix.quat2.conjugate(this.tempTransform, newParent.transformWorld);
glMatrix.quat2.mul(this.tempTransform, this.tempTransform, this.object.transformWorld);

this.object.parent = newParent;
/* Restore transformation after parenting */

Cheers :slightly_smiling_face:
Oh, since you’re using PhysX, make sure to also set .kinematic = true for the grabbed object and .kinematic = false when you let go, otherwise it will obviously not follow the object, but rather the object would follow the rigidbody (which does nothing).