Difference between mesh.attachToBone & mesh.parent = BONE

What’s the difference between mesh.attachToBone(BONE, MESH) & mesh.parent = BONE

I would suggest to rely on attachToBone which internally does mesh.parent = BONE but also adds the extra steps to compute the proper scalingDeterminant, prepare the skeleton for the newly attached mesh:

     * Attach the current TransformNode to another TransformNode associated with a bone
     * @param bone Bone affecting the TransformNode
     * @param affectedTransformNode TransformNode associated with the bone
     * @returns this object
    public attachToBone(bone: Bone, affectedTransformNode: TransformNode): TransformNode {
        this._transformToBoneReferal = affectedTransformNode;
        this.parent = bone;


        if (bone.getWorldMatrix().determinant() < 0) {
            this.scalingDeterminant *= -1;
        return this;

I was just curious if there was something “special” about how the parenting/attach works with this kind of case.

1 Like