Example #1
0
 /// <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();
     }
 }
Example #2
0
 /// <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();
 }
Example #3
0
 internal override void Destroy()
 {
     BulletRigidBody.Dispose();
     BulletRigidBody       = null;
     BulletCollisionObject = null;
 }
Example #4
0
 /// <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();
 }
Example #5
0
 /// <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();
 }
Example #6
0
 /// <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();
 }
Example #7
0
 /// <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);
 }
Example #8
0
 /// <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);
 }
Example #9
0
 /// <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();
 }