- Home /

# How to make an animated mesh be in bindpose?

Is there a way to make a skinned mesh have it's armature be in bind pose? I can't seem to find any way to this.

Preferably I'd like to do this in code

### People who like this

**Answer** by Steven-1
·
Aug 30, 2022 at 11:40 AM

Couldn't find a simple function or setting (which is odd IMO, as this should be an easy thing for Unity to add), But I managed to do it like this:

```
var bindposes = smr.sharedMesh.bindposes;
var bones = smr.bones;
var parents = new Transform[bones.Length];
for (int i = 0; i < bones.Length; i++)
{
parents[i] = bones[i].parent;
bones[i].parent = null;
}
for (int i = 0; i < bones.Length; i++)
{
bones[i].localScale = bindposes[i].inverse.ExtractScale();
bones[i].rotation = bindposes[i].inverse.ExtractRotation();
bones[i].position = bindposes[i].inverse.ExtractPosition();
}
for (int i = 0; i < bones.Length; i++)
{
bones[i].parent = parents[i];
}
```

using these extension methods: (which I got from https://forum.unity.com/threads/how-to-assign-matrix4x4-to-transform.121966/)

```
public static class MatrixExtensions
{
public static Quaternion ExtractRotation(this Matrix4x4 matrix)
{
Vector3 forward;
forward.x = matrix.m02;
forward.y = matrix.m12;
forward.z = matrix.m22;
Vector3 upwards;
upwards.x = matrix.m01;
upwards.y = matrix.m11;
upwards.z = matrix.m21;
return Quaternion.LookRotation(forward, upwards);
}
public static Vector3 ExtractPosition(this Matrix4x4 matrix)
{
Vector3 position;
position.x = matrix.m03;
position.y = matrix.m13;
position.z = matrix.m23;
return position;
}
public static Vector3 ExtractScale(this Matrix4x4 matrix)
{
Vector3 scale;
scale.x = new Vector4(matrix.m00, matrix.m10, matrix.m20, matrix.m30).magnitude;
scale.y = new Vector4(matrix.m01, matrix.m11, matrix.m21, matrix.m31).magnitude;
scale.z = new Vector4(matrix.m02, matrix.m12, matrix.m22, matrix.m32).magnitude;
return scale;
}
}
```

### Your answer

### Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

### Follow this Question

### Related Questions

Editing mesh and removing partial animations? 0 Answers

How to reduce the number of bones in a rig 0 Answers

Ragdoll on Only Part of a Model 2 Answers

Raycast from Head Bone 2 Answers