public static BoxRigidHardConstraint GetDefaultBoxRigidHardConstraint( Vector3 positionXNA, Material material, Vector3 halfSize, Vector3?acc, Vector3?initialForce, Vector3?initialTorque, float orientationValue = 0, bool obInertia = false) { BoxRigidHardConstraint rectToReturn = new BoxRigidHardConstraint(positionXNA, material, new Vector3(halfSize.X, halfSize.Y, 0)); // Inertia if (obInertia) { rectToReturn.SetObInertia(); // Awaking rectToReturn.SetAwake(true); return(rectToReturn); } // Acc Vector3 accVector = acc ?? new Vector3(0, -StaticData.GravityConstant, 0); rectToReturn.SetAcceleration(accVector); // Force Vector3 forceIn = initialForce ?? new Vector3(0, 0, 0); rectToReturn.AddForce(forceIn); // Torque Vector3 torqueIn = initialTorque ?? new Vector3(0, 0, 0); rectToReturn.AddTorque(torqueIn, MathHelperModule.GetInverseYPosition(rectToReturn.PositionCenterEngine)); // Orientation rectToReturn.SetOrientation(orientationValue); // Awaking rectToReturn.SetAwake(true); return(rectToReturn); }
public static SphereRigid GetDefaultSphere( Vector3 positionXNA, Material material, float radius, Vector3?acc, Vector3?initialForce, Vector3?initialTorque, float orientationValue = 0, bool obInertia = false) { SphereRigid rectToReturn = new SphereRigid(positionXNA, material, radius); // Inertia if (obInertia) { rectToReturn.SetObInertia(); // Awaking rectToReturn.SetAwake(true); return(rectToReturn); } // Acc Vector3 accVector = acc ?? new Vector3(0, 0, 0); rectToReturn.SetAcceleration(accVector); // Forece Vector3 forceIn = initialForce ?? new Vector3(0, 0, 0); rectToReturn.AddForce(forceIn); // Torque Vector3 torqueIn = initialTorque ?? new Vector3(0, 0, 0); rectToReturn.AddTorque(torqueIn, MathHelperModule.GetInverseYPosition(rectToReturn.PositionCenterEngine)); // Orientation rectToReturn.SetOrientation(orientationValue); // Awaking rectToReturn.SetAwake(true); return(rectToReturn); }