Class RigidBodyMotionState

java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.objects.infos.RigidBodyMotionState
All Implemented Interfaces:
com.jme3.export.Savable, com.jme3.util.clone.JmeCloneable, Cloneable, Comparable<NativePhysicsObject>

public class RigidBodyMotionState extends NativePhysicsObject implements com.jme3.util.clone.JmeCloneable, com.jme3.export.Savable
The motion state (transform) of a rigid body, with thread-safe access.
  • Field Details

    • logger

      public static final Logger logger
      message logger for this class
  • Constructor Details

    • RigidBodyMotionState

      public RigidBodyMotionState()
      Instantiate a motion state.
  • Method Details

    • applyTransform

      public boolean applyTransform(com.jme3.scene.Spatial spatial)
      If the motion state has been updated, apply the new transform to the specified Spatial.
      Parameters:
      spatial - where to apply the physics transform (not null, modified)
      Returns:
      true if changed
    • getLocation

      public com.jme3.math.Vector3f getLocation(com.jme3.math.Vector3f storeResult)
      Copy the location to a Vector3f.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the location vector (in physics-space coordinates, either storeResult or a new vector, not null)
    • getLocationDp

      public com.simsilica.mathd.Vec3d getLocationDp(com.simsilica.mathd.Vec3d storeResult)
      Copy the location to a Vector3d.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the location vector (in physics-space coordinates, either storeResult or a new vector, not null, finite)
    • getOrientation

      public com.jme3.math.Matrix3f getOrientation(com.jme3.math.Matrix3f storeResult)
      Copy the orientation to a Matrix3f.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the orientation (in physics-space coordinates, either storeResult or a new matrix, not null)
    • getOrientation

      public com.jme3.math.Quaternion getOrientation(com.jme3.math.Quaternion storeResult)
      Copy the orientation to a Quaternion.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the orientation (in physics-space coordinates, either storeResult or a new instance, not null)
    • getOrientationMatrixDp

      public com.simsilica.mathd.Matrix3d getOrientationMatrixDp(com.simsilica.mathd.Matrix3d storeResult)
      Copy the orientation to a Matrix3d.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the orientation (in physics-space coordinates, either storeResult or a new matrix, not null)
    • getOrientationQuaternionDp

      public com.simsilica.mathd.Quatd getOrientationQuaternionDp(com.simsilica.mathd.Quatd storeResult)
      Copy the orientation to a Quatd.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the orientation (in physics-space coordinates, either storeResult or a new instance, not null)
    • isApplyPhysicsLocal

      public boolean isApplyPhysicsLocal()
      Test whether physics-space coordinates should match the spatial's local coordinates.
      Returns:
      true if matching local coordinates, false if matching world coordinates
    • physicsTransform

      public com.jme3.math.Transform physicsTransform(com.jme3.math.Transform storeResult)
      Calculate the body's physics transform.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the body's transform in physics-space coordinates (either storeResult or a new instance, not null)
    • setApplyPhysicsLocal

      public void setApplyPhysicsLocal(boolean applyPhysicsLocal)
      Alter whether physics-space coordinates should match the spatial's local coordinates.
      Parameters:
      applyPhysicsLocal - true→match local coordinates, false→match world coordinates (default=false)
    • setVehicle

      public void setVehicle(PhysicsVehicle vehicle)
      Alter which vehicle uses this motion state.
      Parameters:
      vehicle - the desired vehicle, or null for none (alias created)
    • cloneFields

      public void cloneFields(com.jme3.util.clone.Cloner cloner, Object original)
      Callback from Cloner to convert this shallow-cloned state into a deep-cloned one, using the specified Cloner and original to resolve copied fields.
      Specified by:
      cloneFields in interface com.jme3.util.clone.JmeCloneable
      Parameters:
      cloner - the Cloner that's cloning this state (not null)
      original - the instance from which this state was shallow-cloned
    • jmeClone

      public RigidBodyMotionState jmeClone()
      Create a shallow clone for the JME cloner.
      Specified by:
      jmeClone in interface com.jme3.util.clone.JmeCloneable
      Returns:
      a new instance
    • read

      public void read(com.jme3.export.JmeImporter importer) throws IOException
      De-serialize this state from the specified importer, for example when loading from a J3O file.
      Specified by:
      read in interface com.jme3.export.Savable
      Parameters:
      importer - (not null)
      Throws:
      IOException - from the importer
    • write

      public void write(com.jme3.export.JmeExporter exporter) throws IOException
      Serialize this object to the specified exporter, for example when saving to a J3O file.
      Specified by:
      write in interface com.jme3.export.Savable
      Parameters:
      exporter - (not null)
      Throws:
      IOException - from the exporter