private void UpdateTransform() { Mat2D.FromRotation(m_Transform, m_Rotation); m_Transform[4] = m_Translation[0]; m_Transform[5] = m_Translation[1]; Mat2D.Scale(m_Transform, m_Transform, m_Scale); }
void ConstrainRotation(BoneChain fk, float rotation) { ActorBone bone = fk.m_Bone; Mat2D parentWorld = bone.Parent.WorldTransform; Mat2D transform = bone.Transform; TransformComponents c = fk.m_TransformComponents; if (rotation == 0.0f) { Mat2D.Identity(transform); } else { Mat2D.FromRotation(transform, rotation); } // Translate transform[4] = c.X; transform[5] = c.Y; // Scale float scaleX = c.ScaleX; float scaleY = c.ScaleY; transform[0] *= scaleX; transform[1] *= scaleX; transform[2] *= scaleY; transform[3] *= scaleY; // Skew float skew = c.Skew; if (skew != 0.0) { transform[2] = transform[0] * skew + transform[2]; transform[3] = transform[1] * skew + transform[3]; } Mat2D.Multiply(bone.WorldTransform, parentWorld, transform); }