Class PhysicsCollisionObject

java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.collision.PhysicsCollisionObject
All Implemented Interfaces:
com.jme3.export.Savable, com.jme3.util.clone.JmeCloneable, Cloneable, Comparable<NativePhysicsObject>
Direct Known Subclasses:
MultiBodyCollider, PhysicsBody, PhysicsCharacter, PhysicsGhostObject

public abstract class PhysicsCollisionObject extends NativePhysicsObject implements com.jme3.util.clone.JmeCloneable, com.jme3.export.Savable
The abstract base class for collision objects based on Bullet's btCollisionObject.

Subclasses include MultiBodyCollider, PhysicsBody, PhysicsCharacter, and PhysicsGhostObject.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    collisionGroup/collideWithGroups bitmask that represents group #1
    static final int
    collisionGroup/collideWithGroups bitmask that represents group #2
    static final int
    collisionGroup/collideWithGroups bitmask that represents group #3
    static final int
    collisionGroup/collideWithGroups bitmask that represents group #4
    static final int
    collisionGroup/collideWithGroups bitmask that represents group #5
    static final int
    collisionGroup/collideWithGroups bitmask that represents group #6
    static final int
    collisionGroup/collideWithGroups bitmask that represents group #7
    static final int
    collisionGroup/collideWithGroups bitmask that represents group #8
    static final int
    collisionGroup/collideWithGroups bitmask that represents group #9
    static final int
    collisionGroup/collideWithGroups bitmask that represents group #10
    static final int
    collisionGroup/collideWithGroups bitmask that represents group #11
    static final int
    collisionGroup/collideWithGroups bitmask that represents group #12
    static final int
    collisionGroup/collideWithGroups bitmask that represents group #13
    static final int
    collisionGroup/collideWithGroups bitmask that represents group #14
    static final int
    collisionGroup/collideWithGroups bitmask that represents group #15
    static final int
    collisionGroup/collideWithGroups bitmask that represents group #16
    static final int
    collideWithGroups bitmask that represents "no groups"
    static final Logger
    message logger for this class

    Fields inherited from class com.jme3.bullet.NativePhysicsObject

    loggerN
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Instantiate a collision object with no tracker and no assigned native object.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    activate(boolean forceFlag)
    Reactivate the collision object if it has been deactivated due to lack of motion.
    void
    addCollideWithGroup(int collisionGroup)
    Add collision groups to the set with which this object can collide.
    void
    Add another collision object to this object's ignore list and vice versa.
    protected static void
    attachCollisionShape(long objectId, long collisionShapeId)
    Attach the identified btCollisionShape to the identified btCollisionObject.
    com.jme3.bounding.BoundingBox
    boundingBox(com.jme3.bounding.BoundingBox storeResult)
    Calculate an axis-aligned bounding box for this object, based on its collision shape.
    void
    Clear this object's ignore list.
    void
    cloneFields(com.jme3.util.clone.Cloner cloner, Object original)
    Callback from Cloner to convert this shallow-cloned instance into a deep-cloned one, using the specified Cloner and original to resolve copied fields.
    protected void
    cloneIgnoreList(com.jme3.util.clone.Cloner cloner, PhysicsCollisionObject old)
    Clone the ignore list.
    int
    Return the collision flags.
    final void
    Copy common properties from another collision object.
    int
    Count the collision objects in this object's ignore list.
    Access the listener for new debug meshes.
    jme3utilities.MeshNormals
    Determine which normals to include in new debug meshes.
    int
    Return the resolution for new debug meshes.
    int
    Determine how many sides of this object's default debug materials are visible.
    protected static void
    finalizeNative(long objectId)
    Finalize the identified btCollisionObject.
    findInstance(long pcoId)
    Find the collision object with the specified ID.
    int
    Return this object's activation state (native field: m_activationState1).
    com.jme3.math.Vector3f
    getAnisotropicFriction(com.jme3.math.Vector3f storeResult)
    Copy this object's anisotropic friction components (native field: m_anisotropicFriction).
    Access any application-specific data associated with the collision object.
    float
    Return the continuous collision detection (CCD) motion threshold (native field: m_ccdMotionThreshold).
    float
    Return the squared motion threshold.
    float
    Return the radius of the sphere used for continuous collision detection (CCD) (native field: m_ccdSweptSphereRadius).
    int
    Return the set of collision groups with which this object can collide.
    int
    Return the collision group of this object.
    Access the shape of the collision object.
    Access the space where the collision object is added.
    float
    Return the contact damping (native field: m_contactDamping).
    float
    Return the contact-processing threshold (native field: m_contactProcessingThreshold).
    float
    Return the contact stiffness (native field: m_contactStiffness).
    float
    Return the deactivation time (native field: m_deactivationTime).
    com.jme3.material.Material
    Access the custom debug material, if specified.
    float
    Return the collision object's friction parameter (native field: m_friction).
    protected static final int
    getInternalType(long objectId)
    Return the type of this object.
    com.jme3.math.Vector3f
    For compatibility with the jme3-jbullet library.
    com.jme3.math.Vector3f
    getPhysicsLocation(com.jme3.math.Vector3f storeResult)
    Locate the collision object's center.
    com.simsilica.mathd.Vec3d
    getPhysicsLocationDp(com.simsilica.mathd.Vec3d storeResult)
    Locate the collision object's center in double precision.
    com.jme3.math.Quaternion
    getPhysicsRotation(com.jme3.math.Quaternion storeResult)
    Copy the orientation (rotation) of the collision object to a Quaternion.
    com.simsilica.mathd.Quatd
    getPhysicsRotationDp(com.simsilica.mathd.Quatd storeResult)
    Copy the orientation (rotation) of this object to a Quatd.
    com.jme3.math.Matrix3f
    getPhysicsRotationMatrix(com.jme3.math.Matrix3f storeResult)
    Copy the orientation of the collision object (the basis of its local coordinate system) to a Matrix3f.
    com.simsilica.mathd.Matrix3d
    getPhysicsRotationMatrixDp(com.simsilica.mathd.Matrix3d storeResult)
    Copy the orientation of the collision object (the basis of its local coordinate system) to a Matrix3d.
    float
    Return the collision object's restitution (bounciness) (native field: m_restitution).
    float
    Return this object's rolling friction (native field: m_rollingFriction).
    com.jme3.math.Vector3f
    getScale(com.jme3.math.Vector3f storeResult)
    Copy the scale of this object.
    float
    Return this object's spinning friction (native field: m_spinningFriction).
    com.jme3.math.Transform
    getTransform(com.jme3.math.Transform storeResult)
    Copy the coordinate transform of this object, including the scale of its shape.
    Access the scene object that's using the collision object, typically a PhysicsControl, PhysicsLink, or Spatial.
    boolean
    Test whether the collision object has anisotropic friction.
    boolean
    Test whether the specified collision object is in the current collision object's ignore list.
    protected void
    (Re-)initialize the native user info of this collision object, which stores the collision group, collide-with groups, and spaceId (native field: m_userPointer).
    boolean
    Test whether the collision object has been deactivated due to lack of motion.
    final boolean
    Test whether the collision object responds to contact with other objects.
    final boolean
    Test whether the collision object is added to a space.
    final boolean
    Test whether the collision object is static (immobile).
    Create a shallow clone for the JME cloner.
    Enumerate all collision objects in this object's ignore list.
    Return the collision group of the collision object's broadphase proxy.
    Return the collision mask of this object's broadphase proxy.
    void
    read(com.jme3.export.JmeImporter importer)
    De-serialize the collision object from the specified importer, for example when loading from a J3O file.
    protected final void
    readPcoProperties(com.jme3.export.InputCapsule capsule)
    Read common properties from a capsule.
    void
    removeCollideWithGroup(int collisionGroup)
    Remove collision groups from the set with which this object can collide.
    void
    Remove a collision object from this object's ignore list and vice versa.
    protected static void
    setActivationState(long objectId, int desiredState)
    Alter the activation state of the collision object.
    void
    setAnisotropicFriction(com.jme3.math.Vector3f components, int mode)
    Alter this object's anisotropic friction (native field: m_anisotropicFriction).
    void
    Associate application-specific data with this collision object.
    void
    setCcdMotionThreshold(float threshold)
    Alter the amount of motion required to trigger continuous collision detection (CCD) (native field: m_ccdMotionThreshold).
    void
    Alter the continuous collision detection (CCD) swept-sphere radius for this object (native field: m_ccdSweptSphereRadius).
    void
    setCollideWithGroups(int collisionGroups)
    Directly alter the collision groups with which this object can collide.
    protected static void
    setCollisionFlags(long objectId, int desiredFlags)
    Alter the collision flags of the collision object (native field: m_collisionFlags).
    void
    setCollisionGroup(int collisionGroup)
    Alter which collision group this object belongs to.
    void
    Apply the specified shape to the collision object.
    void
    setContactDamping(float damping)
    Alter the contact damping (native field: m_contactDamping).
    void
    Alter the contact-processing threshold (native field: m_contactProcessingThreshold).
    void
    setContactStiffness(float stiffness)
    Alter the contact stiffness (native field: m_contactStiffness).
    void
    setDeactivationTime(float time)
    Alter the deactivation time (native field: m_deactivationTime).
    void
    setDebugMaterial(com.jme3.material.Material material)
    Apply or remove a custom debug material.
    void
    Apply or remove a listener for new debug meshes.
    void
    setDebugMeshNormals(jme3utilities.MeshNormals newSetting)
    Alter which normals to include in new debug meshes.
    void
    setDebugMeshResolution(int newSetting)
    Alter the mesh resolution for new debug meshes.
    void
    setDebugNumSides(int numSides)
    Alter how many sides of this object's default debug materials are visible.
    void
    setFriction(float friction)
    Alter the collision object's friction (native field: m_friction).
    void
    Replace the ignore list.
    protected void
    setLocationAndBasis(com.jme3.math.Vector3f centerLocation, com.jme3.math.Matrix3f orientation)
    Directly alter the collision object's location and basis.
    void
    setRestitution(float restitution)
    Alter the collision object's restitution (bounciness) (native field: m_restitution).
    void
    setRollingFriction(float friction)
    Alter this object's rolling friction: torsional friction orthogonal to the contact normal (native field: m_rollingFriction).
    void
    setSpinningFriction(float friction)
    Alter this object's spinning friction: torsional friction around the contact normal (native field: m_spinningFriction).
    void
    setUserIndex(int index)
    Alter the collision object's primary user index.
    void
    setUserIndex2(int index)
    Alter the collision object's secondary user index.
    void
    setUserIndex3(int index)
    Alter the collision object's tertiary user index.
    void
    Associate a "user" with the collision object.
    long
    Return the ID of the space where the collision object is added.
    Represent the collision object as a String.
    int
    Return the collision object's primary user index (native field: m_userIndex).
    int
    Return the collision object's secondary user index (native field: m_userIndex2).
    int
    Return the collision object's tertiary user index (native field: m_userIndex3).
    void
    write(com.jme3.export.JmeExporter exporter)
    Serialize the collision object to the specified exporter, for example when saving to a J3O file.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • COLLISION_GROUP_NONE

      public static final int COLLISION_GROUP_NONE
      collideWithGroups bitmask that represents "no groups"
      See Also:
    • COLLISION_GROUP_01

      public static final int COLLISION_GROUP_01
      collisionGroup/collideWithGroups bitmask that represents group #1
      See Also:
    • COLLISION_GROUP_02

      public static final int COLLISION_GROUP_02
      collisionGroup/collideWithGroups bitmask that represents group #2
      See Also:
    • COLLISION_GROUP_03

      public static final int COLLISION_GROUP_03
      collisionGroup/collideWithGroups bitmask that represents group #3
      See Also:
    • COLLISION_GROUP_04

      public static final int COLLISION_GROUP_04
      collisionGroup/collideWithGroups bitmask that represents group #4
      See Also:
    • COLLISION_GROUP_05

      public static final int COLLISION_GROUP_05
      collisionGroup/collideWithGroups bitmask that represents group #5
      See Also:
    • COLLISION_GROUP_06

      public static final int COLLISION_GROUP_06
      collisionGroup/collideWithGroups bitmask that represents group #6
      See Also:
    • COLLISION_GROUP_07

      public static final int COLLISION_GROUP_07
      collisionGroup/collideWithGroups bitmask that represents group #7
      See Also:
    • COLLISION_GROUP_08

      public static final int COLLISION_GROUP_08
      collisionGroup/collideWithGroups bitmask that represents group #8
      See Also:
    • COLLISION_GROUP_09

      public static final int COLLISION_GROUP_09
      collisionGroup/collideWithGroups bitmask that represents group #9
      See Also:
    • COLLISION_GROUP_10

      public static final int COLLISION_GROUP_10
      collisionGroup/collideWithGroups bitmask that represents group #10
      See Also:
    • COLLISION_GROUP_11

      public static final int COLLISION_GROUP_11
      collisionGroup/collideWithGroups bitmask that represents group #11
      See Also:
    • COLLISION_GROUP_12

      public static final int COLLISION_GROUP_12
      collisionGroup/collideWithGroups bitmask that represents group #12
      See Also:
    • COLLISION_GROUP_13

      public static final int COLLISION_GROUP_13
      collisionGroup/collideWithGroups bitmask that represents group #13
      See Also:
    • COLLISION_GROUP_14

      public static final int COLLISION_GROUP_14
      collisionGroup/collideWithGroups bitmask that represents group #14
      See Also:
    • COLLISION_GROUP_15

      public static final int COLLISION_GROUP_15
      collisionGroup/collideWithGroups bitmask that represents group #15
      See Also:
    • COLLISION_GROUP_16

      public static final int COLLISION_GROUP_16
      collisionGroup/collideWithGroups bitmask that represents group #16
      See Also:
    • logger

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

    • PhysicsCollisionObject

      protected PhysicsCollisionObject()
      Instantiate a collision object with no tracker and no assigned native object.

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

  • Method Details

    • activate

      public void activate(boolean forceFlag)
      Reactivate the collision object if it has been deactivated due to lack of motion.

      Deactivation doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Parameters:
      forceFlag - true to force activation
    • addCollideWithGroup

      public void addCollideWithGroup(int collisionGroup)
      Add collision groups to the set with which this object can collide.

      Two objects can collide only if one of them has the collisionGroup of the other in its collideWithGroups set.

      Parameters:
      collisionGroup - the groups to add, ORed together (bitmask)
    • addToIgnoreList

      public void addToIgnoreList(PhysicsCollisionObject otherPco)
      Add another collision object to this object's ignore list and vice versa.

      Any collisions with objects on the list will be ignored. However, the wheels of a PhysicsVehicle aren't collision objects, so the vehicle's ignore list doesn't affect them.

      Parameters:
      otherPco - the other collision object (not null, not this, modified)
    • boundingBox

      public com.jme3.bounding.BoundingBox boundingBox(com.jme3.bounding.BoundingBox storeResult)
      Calculate an axis-aligned bounding box for this object, based on its collision shape. Note: the calculated bounds are seldom minimal; they are typically larger than necessary due to centering constraints and collision margins.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      a bounding box in physics-space coordinates (either storeResult or a new instance)
    • clearIgnoreList

      public void clearIgnoreList()
      Clear this object's ignore list.
    • collisionFlags

      public int collisionFlags()
      Return the collision flags. Flag values are defined in CollisionFlag.
      Returns:
      the values of all flags that are set, ORed together
    • copyPcoProperties

      public final void copyPcoProperties(PhysicsCollisionObject old)
      Copy common properties from another collision object. Used during cloning.
      Parameters:
      old - the instance to copy from (not null, unaffected)
    • countIgnored

      public int countIgnored()
      Count the collision objects in this object's ignore list.
      Returns:
      the count (≥0)
      See Also:
    • debugMeshInitListener

      public DebugMeshInitListener debugMeshInitListener()
      Access the listener for new debug meshes.
      Returns:
      the pre-existing instance, or null if none
    • debugMeshNormals

      public jme3utilities.MeshNormals debugMeshNormals()
      Determine which normals to include in new debug meshes.
      Returns:
      an enum value (not null)
    • debugMeshResolution

      public int debugMeshResolution()
      Return the resolution for new debug meshes.
      Returns:
      0→low, 1→high for convex shapes, 2→high for all shapes
    • debugNumSides

      public int debugNumSides()
      Determine how many sides of this object's default debug materials are visible.
      Returns:
      the number of sides (≥0, ≤2)
    • findInstance

      public static PhysicsCollisionObject findInstance(long pcoId)
      Find the collision object with the specified ID. Native method.
      Parameters:
      pcoId - the native identifier (not zero)
      Returns:
      the pre-existing instance, or null if it's been reclaimed
    • getActivationState

      public int getActivationState()
      Return this object's activation state (native field: m_activationState1).

      Deactivation doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Returns:
      the state (1=active tag, 2=island sleeping, 3=wants deactivation, 4=disable deactivation, 5=disable simulation)
      See Also:
    • getAnisotropicFriction

      public com.jme3.math.Vector3f getAnisotropicFriction(com.jme3.math.Vector3f storeResult)
      Copy this object's anisotropic friction components (native field: m_anisotropicFriction).

      Friction doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the components of the friction (either storeResult or a new vector, not null)
    • getApplicationData

      public Object getApplicationData()
      Access any application-specific data associated with the collision object.
      Returns:
      the pre-existing instance, or null if none
      See Also:
    • getCcdMotionThreshold

      public float getCcdMotionThreshold()
      Return the continuous collision detection (CCD) motion threshold (native field: m_ccdMotionThreshold).

      CCD doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Returns:
      the minimum distance per simulation step to trigger CCD (in physics-space units, ≥0)
    • getCcdSquareMotionThreshold

      public float getCcdSquareMotionThreshold()
      Return the squared motion threshold.

      CCD doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Returns:
      the minimum distance squared (in physics-space units, ≥0)
    • getCcdSweptSphereRadius

      public float getCcdSweptSphereRadius()
      Return the radius of the sphere used for continuous collision detection (CCD) (native field: m_ccdSweptSphereRadius).

      CCD doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Returns:
      the radius (in physics-space units, ≥0)
    • getCollideWithGroups

      public int getCollideWithGroups()
      Return the set of collision groups with which this object can collide.
      Returns:
      the bitmask
    • getCollisionGroup

      public int getCollisionGroup()
      Return the collision group of this object.
      Returns:
      the collision group (bitmask with exactly one bit set)
    • getCollisionShape

      public CollisionShape getCollisionShape()
      Access the shape of the collision object.
      Returns:
      the pre-existing instance, or null if none
    • getCollisionSpace

      public CollisionSpace getCollisionSpace()
      Access the space where the collision object is added.
      Returns:
      the pre-existing instance, or null if none
    • getContactDamping

      public float getContactDamping()
      Return the contact damping (native field: m_contactDamping).

      Contact damping doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Returns:
      the damping
    • getContactProcessingThreshold

      public float getContactProcessingThreshold()
      Return the contact-processing threshold (native field: m_contactProcessingThreshold).

      Contact processing doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Returns:
      the threshold distance (in physics-space units)
    • getContactStiffness

      public float getContactStiffness()
      Return the contact stiffness (native field: m_contactStiffness).

      Contact stiffness doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Returns:
      the stiffness
    • getDeactivationTime

      public float getDeactivationTime()
      Return the deactivation time (native field: m_deactivationTime).

      Deactivation doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Returns:
      the time (in seconds)
    • getDebugMaterial

      public com.jme3.material.Material getDebugMaterial()
      Access the custom debug material, if specified.
      Returns:
      the pre-existing instance, or null for default materials
    • getFriction

      public float getFriction()
      Return the collision object's friction parameter (native field: m_friction).

      Friction doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Returns:
      the parameter value (≥0)
    • getPhysicsLocation

      public com.jme3.math.Vector3f getPhysicsLocation()
      For compatibility with the jme3-jbullet library.
      Returns:
      a new location vector (in physics-space coordinates, not null)
    • getPhysicsLocation

      public com.jme3.math.Vector3f getPhysicsLocation(com.jme3.math.Vector3f storeResult)
      Locate the collision object's center.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      a location vector (in physics-space coordinates, either storeResult or a new vector, finite)
    • getPhysicsLocationDp

      public com.simsilica.mathd.Vec3d getPhysicsLocationDp(com.simsilica.mathd.Vec3d storeResult)
      Locate the collision object's center in double precision.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      a location vector (in physics-space coordinates, either storeResult or a new vector, not null, finite)
    • getPhysicsRotation

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

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

      public com.jme3.math.Matrix3f getPhysicsRotationMatrix(com.jme3.math.Matrix3f storeResult)
      Copy the orientation of the collision object (the basis of its local coordinate system) to a Matrix3f.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      a rotation matrix (in physics-space coordinates, either storeResult or a new matrix, not null)
    • getPhysicsRotationMatrixDp

      public com.simsilica.mathd.Matrix3d getPhysicsRotationMatrixDp(com.simsilica.mathd.Matrix3d storeResult)
      Copy the orientation of the collision object (the basis of its local coordinate system) to a Matrix3d.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      a rotation matrix (in physics-space coordinates, either storeResult or a new matrix, not null)
    • getRestitution

      public float getRestitution()
      Return the collision object's restitution (bounciness) (native field: m_restitution).

      Restitution doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Returns:
      restitution value
    • getRollingFriction

      public float getRollingFriction()
      Return this object's rolling friction (native field: m_rollingFriction).

      Friction doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Returns:
      friction value
    • getScale

      public com.jme3.math.Vector3f getScale(com.jme3.math.Vector3f storeResult)
      Copy the scale of this object.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the scale factor for each local axis (either storeResult or a new vector, not null, no negative component)
    • getSpinningFriction

      public float getSpinningFriction()
      Return this object's spinning friction (native field: m_spinningFriction).

      Friction doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Returns:
      friction value
    • getTransform

      public com.jme3.math.Transform getTransform(com.jme3.math.Transform storeResult)
      Copy the coordinate transform of this object, including the scale of its shape.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      a coordinate transform (in physics-space coordinates, either storeResult or a new Transform, not null)
    • getUserObject

      public Object getUserObject()
      Access the scene object that's using the collision object, typically a PhysicsControl, PhysicsLink, or Spatial. Used by physics controls.
      Returns:
      the pre-existing instance, or null if none
      See Also:
    • hasAnisotropicFriction

      public boolean hasAnisotropicFriction(int mode)
      Test whether the collision object has anisotropic friction.

      Friction doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Parameters:
      mode - the mode(s) to test for: 1=basic anisotropic friction, 2=anisotropic rolling friction, 3=either one
      Returns:
      true if (one of) the specified mode(s) is active, otherwise false
    • ignores

      public boolean ignores(PhysicsCollisionObject other)
      Test whether the specified collision object is in the current collision object's ignore list.
      Parameters:
      other - the collision object to search for
      Returns:
      true if found, otherwise false
      See Also:
    • isActive

      public boolean isActive()
      Test whether the collision object has been deactivated due to lack of motion.

      Deactivation doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Returns:
      true if object still active, false if deactivated
    • isContactResponse

      public final boolean isContactResponse()
      Test whether the collision object responds to contact with other objects. All ghost objects are non-responsive. Other types are responsive by default.
      Returns:
      true if responsive, otherwise false
    • isInWorld

      public final boolean isInWorld()
      Test whether the collision object is added to a space.
      Returns:
      true→added to a space, false→not added to a space
    • isStatic

      public final boolean isStatic()
      Test whether the collision object is static (immobile).
      Returns:
      true if static, otherwise false
    • listIgnoredPcos

      public PhysicsCollisionObject[] listIgnoredPcos()
      Enumerate all collision objects in this object's ignore list.
      Returns:
      a new array (not null, may be empty)
      See Also:
    • proxyGroup

      public Integer proxyGroup()
      Return the collision group of the collision object's broadphase proxy. A proxy is created when the collision object is added to a space, and its group is 32 for a PhysicsCharacter, 2 for a static object, or 1 for anything else.
      Returns:
      the proxy's collision group (a bitmask with exactly one bit set) or null if this object has no proxy
    • proxyMask

      public Integer proxyMask()
      Return the collision mask of this object's broadphase proxy. A proxy is created when the collision object is added to a space, and its mask is -3 for a static object or -1 for anything else.
      Returns:
      the proxy's bitmask, or null if this object has no proxy
    • removeCollideWithGroup

      public void removeCollideWithGroup(int collisionGroup)
      Remove collision groups from the set with which this object can collide.
      Parameters:
      collisionGroup - the groups to remove, ORed together (bitmask)
    • removeFromIgnoreList

      public void removeFromIgnoreList(PhysicsCollisionObject otherPco)
      Remove a collision object from this object's ignore list and vice versa.
      Parameters:
      otherPco - the other collision object (not null, not this, modified)
    • setAnisotropicFriction

      public void setAnisotropicFriction(com.jme3.math.Vector3f components, int mode)
      Alter this object's anisotropic friction (native field: m_anisotropicFriction).

      Friction doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Parameters:
      components - the desired friction components (not null, unaffected, default=(1,1,1))
      mode - the desired friction mode: 0=isotropic, 1=basic anisotropic friction, 2=anisotropic rolling friction (default=0)
    • setApplicationData

      public void setApplicationData(Object data)
      Associate application-specific data with this collision object. Minie never touches application-specific data, except to clone/load/save it if it is Cloneable or Savable.
      Parameters:
      data - the desired data object (alias created, default=null)
      See Also:
    • setCcdMotionThreshold

      public void setCcdMotionThreshold(float threshold)
      Alter the amount of motion required to trigger continuous collision detection (CCD) (native field: m_ccdMotionThreshold).

      CCD addresses the issue of fast-moving bodies passing through other bodies without creating any contacts.

      CCD doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Parameters:
      threshold - the desired minimum distance per simulation step to trigger CCD (in physics-space units, >0) or zero to disable CCD (default=0)
    • setCcdSweptSphereRadius

      public void setCcdSweptSphereRadius(float radius)
      Alter the continuous collision detection (CCD) swept-sphere radius for this object (native field: m_ccdSweptSphereRadius).

      CCD doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Parameters:
      radius - (in physics-space units, ≥0, default=0)
    • setCollideWithGroups

      public void setCollideWithGroups(int collisionGroups)
      Directly alter the collision groups with which this object can collide.
      Parameters:
      collisionGroups - the desired groups, ORed together (bitmask, default=COLLISION_GROUP_01)
    • setCollisionGroup

      public void setCollisionGroup(int collisionGroup)
      Alter which collision group this object belongs to.

      Groups are represented by bitmasks with exactly one bit set. Manifest constants are defined in PhysicsCollisionObject.

      Two objects can collide only if one of them has the collisionGroup of the other in its collideWithGroups set.

      Parameters:
      collisionGroup - the collisionGroup to apply (bitmask with exactly one bit set, default=COLLISION_GROUP_01)
    • setCollisionShape

      public void setCollisionShape(CollisionShape collisionShape)
      Apply the specified shape to the collision object. Meant to be overridden.
      Parameters:
      collisionShape - the shape to apply (not null, alias created)
    • setContactDamping

      public void setContactDamping(float damping)
      Alter the contact damping (native field: m_contactDamping). Also affects the collision flags.

      Contact damping doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Parameters:
      damping - the desired damping (default=0.1)
    • setContactProcessingThreshold

      public void setContactProcessingThreshold(float distance)
      Alter the contact-processing threshold (native field: m_contactProcessingThreshold).

      Contact processing doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Parameters:
      distance - the desired threshold distance (in physics-space units, default=1e18 with SP library or 1e30 with DP library)
    • setContactStiffness

      public void setContactStiffness(float stiffness)
      Alter the contact stiffness (native field: m_contactStiffness). Also affects the collision flags.

      Contact stiffness doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Parameters:
      stiffness - the desired stiffness (default=1e18 with SP library or 1e30 with DP library)
    • setDeactivationTime

      public void setDeactivationTime(float time)
      Alter the deactivation time (native field: m_deactivationTime).

      Deactivation doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Parameters:
      time - the desired time (in seconds, default=0)
    • setDebugMaterial

      public void setDebugMaterial(com.jme3.material.Material material)
      Apply or remove a custom debug material.
      Parameters:
      material - the Material to use (alias created) or null to use the default debug materials (default=null)
    • setDebugMeshInitListener

      public void setDebugMeshInitListener(DebugMeshInitListener listener)
      Apply or remove a listener for new debug meshes.
      Parameters:
      listener - the listener to use (alias created) or null for none (default=null)
    • setDebugMeshNormals

      public void setDebugMeshNormals(jme3utilities.MeshNormals newSetting)
      Alter which normals to include in new debug meshes.
      Parameters:
      newSetting - an enum value (not null, default=None)
    • setDebugMeshResolution

      public void setDebugMeshResolution(int newSetting)
      Alter the mesh resolution for new debug meshes.
      Parameters:
      newSetting - 0→low, 1→high for convex shapes, 2→high for all shapes (default=0)
    • setDebugNumSides

      public void setDebugNumSides(int numSides)
      Alter how many sides of this object's default debug materials are visible. This setting has no effect on custom debug materials.
      Parameters:
      numSides - the desired number of sides (≥0, ≤2, default=1)
    • setFriction

      public void setFriction(float friction)
      Alter the collision object's friction (native field: m_friction).

      Friction doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Parameters:
      friction - the desired friction value (≥0, default=0.5)
    • setIgnoreList

      public void setIgnoreList(PhysicsCollisionObject[] desiredList)
      Replace the ignore list.
      Parameters:
      desiredList - collision objects to ignore (not null, may be empty, may contain nulls or duplicates or this, unaffected)
    • setRestitution

      public void setRestitution(float restitution)
      Alter the collision object's restitution (bounciness) (native field: m_restitution). For perfect elasticity, set restitution=1.

      Restitution doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Parameters:
      restitution - the desired value (default=0)
    • setRollingFriction

      public void setRollingFriction(float friction)
      Alter this object's rolling friction: torsional friction orthogonal to the contact normal (native field: m_rollingFriction). Use this to stop bodies from rolling.

      Friction doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Parameters:
      friction - the desired friction value (default=0)
    • setSpinningFriction

      public void setSpinningFriction(float friction)
      Alter this object's spinning friction: torsional friction around the contact normal (native field: m_spinningFriction). Use for grasping.

      Friction doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Parameters:
      friction - the desired friction value (default=0)
    • setUserIndex

      public void setUserIndex(int index)
      Alter the collision object's primary user index. Applications may use this parameter for any purpose (native field: m_userIndex).
      Parameters:
      index - the desired value (default=-1)
    • setUserIndex2

      public void setUserIndex2(int index)
      Alter the collision object's secondary user index. Applications may use this parameter for any purpose (native field: m_userIndex2).
      Parameters:
      index - the desired value (default=-1)
    • setUserIndex3

      public void setUserIndex3(int index)
      Alter the collision object's tertiary user index. Applications may use this parameter for any purpose (native field: m_userIndex3).
      Parameters:
      index - the desired value (default=-1)
    • setUserObject

      public void setUserObject(Object user)
      Associate a "user" with the collision object. Used by physics controls.
      Parameters:
      user - the desired scene object (alias created, default=null)
      See Also:
    • spaceId

      public long spaceId()
      Return the ID of the space where the collision object is added.
      Returns:
      the ID, or zero if not added to any space
    • userIndex

      public int userIndex()
      Return the collision object's primary user index (native field: m_userIndex).
      Returns:
      the value of the index
    • userIndex2

      public int userIndex2()
      Return the collision object's secondary user index (native field: m_userIndex2).
      Returns:
      the value of the index
    • userIndex3

      public int userIndex3()
      Return the collision object's tertiary user index (native field: m_userIndex3).
      Returns:
      the value of the index
    • attachCollisionShape

      protected static void attachCollisionShape(long objectId, long collisionShapeId)
      Attach the identified btCollisionShape to the identified btCollisionObject. Native method.
      Parameters:
      objectId - the identifier of the btCollisionObject (not zero)
      collisionShapeId - the identifier of the btCollisionShape (not zero)
    • cloneIgnoreList

      protected void cloneIgnoreList(com.jme3.util.clone.Cloner cloner, PhysicsCollisionObject old)
      Clone the ignore list.
      Parameters:
      cloner - the Cloner that's cloning this collision object (not null, modified)
      old - the instance from which this collision object was shallow-cloned (not null, unaffected)
    • finalizeNative

      protected static void finalizeNative(long objectId)
      Finalize the identified btCollisionObject. Native method.
      Parameters:
      objectId - the ID of the btCollisionObject (not zero)
    • getInternalType

      protected static final int getInternalType(long objectId)
      Return the type of this object. Native method.
      Parameters:
      objectId - the ID of the btCollisionObject (not zero)
      Returns:
      the type value
      See Also:
    • initUserPointer

      protected void initUserPointer()
      (Re-)initialize the native user info of this collision object, which stores the collision group, collide-with groups, and spaceId (native field: m_userPointer).
    • readPcoProperties

      protected final void readPcoProperties(com.jme3.export.InputCapsule capsule) throws IOException
      Read common properties from a capsule.
      Parameters:
      capsule - the input capsule (not null, modified)
      Throws:
      IOException - from the importer
    • setActivationState

      protected static void setActivationState(long objectId, int desiredState)
      Alter the activation state of the collision object. Native method.

      Deactivation doesn't affect a PhysicsCharacter or PhysicsGhostObject.

      Parameters:
      objectId - the ID of the btCollisionObject (not zero)
      desiredState - the desired state
    • setCollisionFlags

      protected static void setCollisionFlags(long objectId, int desiredFlags)
      Alter the collision flags of the collision object (native field: m_collisionFlags). Subclasses are responsible for cloning/loading/saving these flags. Flag values are defined in CollisionFlag. Native method.
      Parameters:
      objectId - the ID of the btCollisionObject (not zero)
      desiredFlags - the desired collision flags, ORed together
    • setLocationAndBasis

      protected void setLocationAndBasis(com.jme3.math.Vector3f centerLocation, com.jme3.math.Matrix3f orientation)
      Directly alter the collision object's location and basis.
      Parameters:
      centerLocation - the desired location for the collision object's center (in physics-space coordinates, not null, unaffected)
      orientation - the desired orientation for the collision object (rotation matrix in physics-space coordinates, not null, unaffected)
    • cloneFields

      public void cloneFields(com.jme3.util.clone.Cloner cloner, Object original)
      Callback from Cloner to convert this shallow-cloned instance 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 the current instance (not null)
      original - the instance from which the current instance was shallow-cloned (unused)
    • jmeClone

      public PhysicsCollisionObject jmeClone()
      Create a shallow clone for the JME cloner. Note that the cloned object won't be added to any space, even if the original was.
      Specified by:
      jmeClone in interface com.jme3.util.clone.JmeCloneable
      Returns:
      a new instance without a native object assigned
    • read

      public void read(com.jme3.export.JmeImporter importer) throws IOException
      De-serialize the collision object 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 the collision 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
    • toString

      public String toString()
      Represent the collision object as a String.
      Overrides:
      toString in class NativePhysicsObject
      Returns:
      a descriptive string of text (not null, not empty)