Class PhysicsBody

All Implemented Interfaces:
Comparable<NativePhysicsObject>
Direct Known Subclasses:
PhysicsRigidBody, PhysicsSoftBody

public abstract class PhysicsBody extends PhysicsCollisionObject
The abstract base class for rigid bodies and soft bodies.
  • Field Details

    • massForStatic

      public static final float massForStatic
      magic mass value used to specify a static rigid body or soft-body node
      See Also:
  • Constructor Details

    • PhysicsBody

      protected PhysicsBody()
      Instantiate a PhysicsBody.

      This no-arg constructor was made explicit to avoid javadoc warnings from JDK 18+.

  • Method Details

    • addJoint

      public void addJoint(PhysicsJoint joint)
      Do not invoke directly! Joints are added automatically when created.
      Parameters:
      joint - the joint to add (not null, alias created)
    • countJoints

      public int countJoints()
      Count how many joints connect to this body. (The semantics have changed since Minie v2.)
      Returns:
      the count (≥0)
    • getDeactivationDeadline

      public static float getDeactivationDeadline()
      Return the global deactivation deadline.
      Returns:
      the deadline (in simulated seconds, >0)
    • getGravity

      public abstract Vector3f getGravity(Vector3f storeResult)
      Copy this body's gravitational acceleration.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      an acceleration vector (in physics-space coordinates, either storeResult or a new vector, not null)
    • getMass

      public abstract float getMass()
      Determine the total mass of this body.
      Returns:
      the total mass (≥0)
    • isDeactivationEnabled

      public static boolean isDeactivationEnabled()
      Test the global deactivation enable flag.
      Returns:
      true if deactivation is enabled, otherwise false
    • listJoints

      public PhysicsJoint[] listJoints()
      Enumerate the joints connected to this body. (The semantics have changed since Minie v2.)
      Returns:
      a new array of pre-existing joints
    • removeJoint

      public void removeJoint(PhysicsJoint joint)
      Do not invoke directly! Joints are removed automatically when destroyed.
      Parameters:
      joint - the joint to remove (not null, unaffected)
      See Also:
    • setDeactivationDeadline

      public static void setDeactivationDeadline(float newDeadline)
      Alter the global deactivation deadline.
      Parameters:
      newDeadline - the desired deadline (in simulated seconds, >0, default=2)
    • setDeactivationEnabled

      public static void setDeactivationEnabled(boolean newSetting)
      Alter the global deactivation enable flag.
      Parameters:
      newSetting - true to enable deactivation, false to disable it (default=true)
    • setGravity

      public abstract void setGravity(Vector3f acceleration)
      Alter this body's gravitational acceleration.

      Invoke this method after adding the body to a PhysicsSpace. Adding a body to a PhysicsSpace overrides its gravity.

      Parameters:
      acceleration - the desired acceleration vector (in physics-space coordinates, not null, unaffected)
    • setMass

      public abstract void setMass(float mass)
      Alter this body's total mass.
      Parameters:
      mass - the desired total mass (≥0)
    • setPhysicsLocation

      public abstract void setPhysicsLocation(Vector3f location)
      Directly relocate this body's center.
      Parameters:
      location - the desired location (in physics-space coordinates, not null, unaffected)