/// <summary> /// Clear all forces from the body. /// </summary> /// <param name="clearVelocity">If true, will also clear current velocity.</param> public void ClearForces(bool clearVelocity = true) { BulletRigidBody.ClearForces(); if (clearVelocity) { ClearVelocity(); } }
/// <summary> /// Apply torque force on the body. /// </summary> /// <param name="torque">Torque force to apply.</param> /// <param name="asImpulse">If true, will apply torque as an impulse.</param> public void ApplyTorque(Vector3 torque, bool asImpulse = false) { if (asImpulse) { BulletRigidBody.ApplyTorqueImpulse(ToBullet.Vector(torque)); } else { BulletRigidBody.ApplyTorque(ToBullet.Vector(torque)); } BulletRigidBody.Activate(); }
internal override void Destroy() { BulletRigidBody.Dispose(); BulletRigidBody = null; BulletCollisionObject = null; }
/// <summary> /// Apply impulse on the body, from its center. /// </summary> /// <param name="impulse">Impulse to apply.</param> public void ApplyImpulse(Vector3 impulse) { BulletRigidBody.ApplyCentralImpulse(ToBullet.Vector(impulse)); BulletRigidBody.Activate(); }
/// <summary> /// Apply force on the body, from a given position. /// </summary> /// <param name="force">Force to apply.</param> /// <param name="from">Force source position.</param> public void ApplyForce(Vector3 force, Vector3 from) { BulletRigidBody.ApplyForce(ToBullet.Vector(force), ToBullet.Vector(from)); BulletRigidBody.Activate(); }
/// <summary> /// Apply force on the body, from its center. /// </summary> /// <param name="force">Force to apply.</param> public void ApplyForce(Vector3 force) { BulletRigidBody.ApplyCentralForce(ToBullet.Vector(force)); BulletRigidBody.Activate(); }
/// <summary> /// Update the mass and inertia of this body. /// </summary> /// <param name="mass">New body mass.</param> /// <param name="inertia">New body inertia.</param> public void SetMassAndInertia(float mass, float inertia) { BulletRigidBody.SetMassProps(mass, _shape.BulletCollisionShape.CalculateLocalInertia(mass) * inertia); }
/// <summary> /// Set damping. /// </summary> /// <param name="linear">Linear damping.</param> /// <param name="angular">Angular damping.</param> public void SetDamping(float linear, float angular) { BulletRigidBody.SetDamping(linear, angular); }
/// <summary> /// Apply impulse on the body, from a given position. /// </summary> /// <param name="impulse">Impulse to apply.</param> /// <param name="from">Impulse source position.</param> public void ApplyImpulse(Vector3 impulse, Vector3 from) { BulletRigidBody.ApplyImpulse(ToBullet.Vector(impulse), ToBullet.Vector(from)); BulletRigidBody.Activate(); }