public static void SetInBodySpace(this HkBallAndSocketConstraintData data, Vector3 pivotA, Vector3 pivotB, MyPhysicsBody bodyA, MyPhysicsBody bodyB) { if (bodyA.IsWelded) { pivotA = Vector3.Transform(pivotA, bodyA.WeldInfo.Transform); } if (bodyB.IsWelded) { pivotB = Vector3.Transform(pivotB, bodyB.WeldInfo.Transform); } data.SetInBodySpaceInternal(ref pivotA, ref pivotB); }
private HkConstraintData CreateBallAndSocketConstraintData(ref Matrix otherLocalMatrix, ref Matrix headPivotLocalMatrix) { HkBallAndSocketConstraintData data = new HkBallAndSocketConstraintData(); Vector3 otherPivot = otherLocalMatrix.Translation; Vector3 headPivot = headPivotLocalMatrix.Translation; data.SetInBodySpace(otherPivot, headPivot, m_otherPhysicsBody, OwnerVirtualPhysics); HkMalleableConstraintData mcData = new HkMalleableConstraintData(); mcData.SetData(data); mcData.Strength = 0.00006f; data.Dispose(); return(mcData); }
private static HkConstraintData CreateBallAndSocketConstraintData(ref Matrix otherLocalMatrix, ref Matrix headPivotLocalMatrix) { HkBallAndSocketConstraintData data = new HkBallAndSocketConstraintData(); Vector3 otherPivot = otherLocalMatrix.Translation; Vector3 headPivot = headPivotLocalMatrix.Translation; data.SetInBodySpace(ref otherPivot, ref headPivot); HkMalleableConstraintData mcData = new HkMalleableConstraintData(); mcData.SetData(data); mcData.Strength = 0.0003f; data.Dispose(); return(mcData); }