Exemplo n.º 1
0
 /// <summary>
 /// Applies a continuous force to the RigidBody at a specified position
 /// Should be called from BulletUpdate()
 /// <param name="force">The continuous force to be applied</param>>
 /// <param name="position">Local position at which to apply the force</param>>
 /// </summary>
 public void ApplyForce(Vector3 force, Vector3 position)
 {
     if (!Initialized || Disposing || !Registered)
     {
         return;
     }
     BodyInstance.ApplyForce(force.ToBullet(), position.ToBullet());
 }
Exemplo n.º 2
0
 /// <summary>
 /// Applies a torque impulse to the RigidBody at a specified position
 /// Should be called from BulletUpdate()
 /// </summary>
 /// <param name="torque">The torque impulse to be applied</param>
 public void ApplyTorqueImpulse(Vector3 impulse)
 {
     if (!Initialized || Disposing || !Registered)
     {
         return;
     }
     BodyInstance.ApplyTorqueImpulse(impulse.ToBullet());
 }
Exemplo n.º 3
0
        /// <summary>
        /// Disposes of the RigidBody
        /// Should only be called internally or from a physics world instance.
        /// </summary>
        public override void Dispose()
        {
            //Dispose of all the components in reverse order
            if (Disposing)
            {
                return;
            }
            if (Registered)
            {
                BulletPhysicsWorldManager.Unregister(BodyInstance);
            }

            Disposing = true;
            BodyInstance?.Dispose();
            _constructionInfo?.Dispose();
            PhysicsMotionState?.Dispose();
            PhysicsCollisionShape?.Dispose();
        }