public abstract class PhysicsCollisionObject extends NativePhysicsObject
btCollisionObject.
Subclasses include MultiBodyCollider, PhysicsBody, PhysicsCharacter, and PhysicsGhostObject.
| Modifier and Type | Field and Description |
|---|---|
static int |
COLLISION_GROUP_01
collisionGroup/collideWithGroups bitmask that represents group #1
|
static int |
COLLISION_GROUP_02
collisionGroup/collideWithGroups bitmask that represents group #2
|
static int |
COLLISION_GROUP_03
collisionGroup/collideWithGroups bitmask that represents group #3
|
static int |
COLLISION_GROUP_04
collisionGroup/collideWithGroups bitmask that represents group #4
|
static int |
COLLISION_GROUP_05
collisionGroup/collideWithGroups bitmask that represents group #5
|
static int |
COLLISION_GROUP_06
collisionGroup/collideWithGroups bitmask that represents group #6
|
static int |
COLLISION_GROUP_07
collisionGroup/collideWithGroups bitmask that represents group #7
|
static int |
COLLISION_GROUP_08
collisionGroup/collideWithGroups bitmask that represents group #8
|
static int |
COLLISION_GROUP_09
collisionGroup/collideWithGroups bitmask that represents group #9
|
static int |
COLLISION_GROUP_10
collisionGroup/collideWithGroups bitmask that represents group #10
|
static int |
COLLISION_GROUP_11
collisionGroup/collideWithGroups bitmask that represents group #11
|
static int |
COLLISION_GROUP_12
collisionGroup/collideWithGroups bitmask that represents group #12
|
static int |
COLLISION_GROUP_13
collisionGroup/collideWithGroups bitmask that represents group #13
|
static int |
COLLISION_GROUP_14
collisionGroup/collideWithGroups bitmask that represents group #14
|
static int |
COLLISION_GROUP_15
collisionGroup/collideWithGroups bitmask that represents group #15
|
static int |
COLLISION_GROUP_16
collisionGroup/collideWithGroups bitmask that represents group #16
|
static int |
COLLISION_GROUP_NONE
collideWithGroups bitmask that represents "no groups"
|
static java.util.logging.Logger |
logger
message logger for this class
|
loggerN| Modifier | Constructor and Description |
|---|---|
protected |
PhysicsCollisionObject()
Instantiate a collision object with no tracker and no assigned native
object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
activate(boolean forceFlag)
Reactivate this 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 |
addToIgnoreList(PhysicsCollisionObject otherPco)
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.
|
BoundingBox |
boundingBox(BoundingBox storeResult)
Calculate an axis-aligned bounding box for this object, based on its
collision shape.
|
void |
clearIgnoreList()
Clear this object's ignore list.
|
int |
collisionFlags()
Return the collision flags.
|
void |
copyPcoProperties(PhysicsCollisionObject old)
Copy common properties from another collision object.
|
int |
countIgnored()
Count the collision objects in this object's ignore list.
|
protected static void |
finalizeNative(long objectId)
Finalize the identified btCollisionObject.
|
static PhysicsCollisionObject |
findInstance(long pcoId)
Find the collision object with the specified ID.
|
int |
getActivationState()
Return this object's activation state (native field: m_activationState1).
|
Vector3f |
getAnisotropicFriction(Vector3f storeResult)
Copy this object's anisotropic friction components (native field:
m_anisotropicFriction).
|
float |
getCcdMotionThreshold()
Return the continuous collision detection (CCD) motion threshold (native
field: m_ccdMotionThreshold).
|
float |
getCcdSquareMotionThreshold()
Return the squared motion threshold.
|
float |
getCcdSweptSphereRadius()
Return the radius of the sphere used for continuous collision detection
(CCD) (native field: m_ccdSweptSphereRadius).
|
int |
getCollideWithGroups()
Return the set of collision groups with which this object can collide.
|
int |
getCollisionGroup()
Return the collision group of this object.
|
CollisionShape |
getCollisionShape()
Access the shape of this object.
|
CollisionSpace |
getCollisionSpace()
Access the space where this object is added.
|
float |
getContactDamping()
Return the contact damping (native field: m_contactDamping).
|
float |
getContactProcessingThreshold()
Return the contact-processing threshold (native field:
m_contactProcessingThreshold).
|
float |
getContactStiffness()
Return the contact stiffness (native field: m_contactStiffness).
|
float |
getDeactivationTime()
Return the deactivation time (native field: m_deactivationTime).
|
float |
getFriction()
Return this object's friction parameter (native field: m_friction).
|
protected static int |
getInternalType(long objectId)
Return the type of this object.
|
Vector3f |
getPhysicsLocation(Vector3f storeResult)
Copy the location of this object's center to a Vector3f.
|
Vec3d |
getPhysicsLocationDp(Vec3d storeResult)
Copy the location of this object's center to a Vec3d.
|
Quaternion |
getPhysicsRotation(Quaternion storeResult)
Copy the orientation (rotation) of this object to a Quaternion.
|
Quatd |
getPhysicsRotationDp(Quatd storeResult)
Copy the orientation (rotation) of this object to a Quatd.
|
Matrix3f |
getPhysicsRotationMatrix(Matrix3f storeResult)
Copy the orientation of this object (the basis of its local coordinate
system) to a Matrix3f.
|
Matrix3d |
getPhysicsRotationMatrixDp(Matrix3d storeResult)
Copy the orientation of this object (the basis of its local coordinate
system) to a Matrix3d.
|
float |
getRestitution()
Return this object's restitution (bounciness) (native field:
m_restitution).
|
float |
getRollingFriction()
Return this object's rolling friction (native field: m_rollingFriction).
|
Vector3f |
getScale(Vector3f storeResult)
Copy the scale of this object.
|
float |
getSpinningFriction()
Return this object's spinning friction (native field:
m_spinningFriction).
|
Transform |
getTransform(Transform storeResult)
Copy the coordinate transform of this object, including the scale of its
shape.
|
TransformDp |
getTransformDp(TransformDp storeResult)
Copy the coordinate transform of this object, including the scale of its
shape.
|
java.lang.Object |
getUserObject()
Access the "user" of this collision object.
|
boolean |
hasAnisotropicFriction(int mode)
Test whether this object has anisotropic friction.
|
boolean |
ignores(PhysicsCollisionObject other)
Test whether the specified collision object is in this object's ignore
list.
|
protected void |
initUserPointer()
(Re-)initialize the native user info of this object, which stores the
collision group, collide-with groups, and spaceId (native field:
m_userPointer).
|
boolean |
isActive()
Test whether this object has been deactivated due to lack of motion.
|
boolean |
isContactResponse()
Test whether this object responds to contact with other objects.
|
boolean |
isInWorld()
Test whether this object is added to a space.
|
boolean |
isStatic()
Test whether this object is static (immobile).
|
PhysicsCollisionObject[] |
listIgnoredPcos()
Enumerate all collision objects in this object's ignore list.
|
java.lang.Integer |
proxyGroup()
Return the collision group of this object's broadphase proxy.
|
java.lang.Integer |
proxyMask()
Return the collision mask of this object's broadphase proxy.
|
void |
removeCollideWithGroup(int collisionGroup)
Remove collision groups from the set with which this object can collide.
|
void |
removeFromIgnoreList(PhysicsCollisionObject otherPco)
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 this object.
|
void |
setAnisotropicFriction(Vector3f components,
int mode)
Alter this object's anisotropic friction (native field:
m_anisotropicFriction).
|
void |
setCcdMotionThreshold(float threshold)
Alter the amount of motion required to trigger continuous collision
detection (CCD) (native field: m_ccdMotionThreshold).
|
void |
setCcdSweptSphereRadius(float radius)
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 this object (native field:
m_collisionFlags).
|
void |
setCollisionGroup(int collisionGroup)
Alter which collision group this object belongs to.
|
void |
setCollisionShape(CollisionShape collisionShape)
Apply the specified shape to this object.
|
void |
setContactDamping(float damping)
Alter the contact damping (native field: m_contactDamping).
|
void |
setContactProcessingThreshold(float distance)
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 |
setFriction(float friction)
Alter this object's friction (native field: m_friction).
|
void |
setIgnoreList(PhysicsCollisionObject[] desiredList)
Replace the ignore list.
|
protected void |
setLocationAndBasis(Vector3f centerLocation,
Matrix3f orientation)
Directly alter this object's location and basis.
|
void |
setRestitution(float restitution)
Alter this 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 object's primary user index.
|
void |
setUserIndex2(int index)
Alter the object's secondary user index.
|
void |
setUserIndex3(int index)
Alter the object's tertiary user index.
|
void |
setUserObject(java.lang.Object user)
Associate a "user" with this collision object.
|
long |
spaceId()
Return the ID of the space where this object is added.
|
java.lang.String |
toString()
Represent this object as a String.
|
int |
userIndex()
Return the object's primary user index (native field: m_userIndex).
|
int |
userIndex2()
Return the object's secondary user index (native field: m_userIndex2).
|
int |
userIndex3()
Return the object's tertiary user index (native field: m_userIndex3).
|
compareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeId, setNativeIdNotTracked, unassignNativeObjectpublic static final int COLLISION_GROUP_NONE
public static final int COLLISION_GROUP_01
public static final int COLLISION_GROUP_02
public static final int COLLISION_GROUP_03
public static final int COLLISION_GROUP_04
public static final int COLLISION_GROUP_05
public static final int COLLISION_GROUP_06
public static final int COLLISION_GROUP_07
public static final int COLLISION_GROUP_08
public static final int COLLISION_GROUP_09
public static final int COLLISION_GROUP_10
public static final int COLLISION_GROUP_11
public static final int COLLISION_GROUP_12
public static final int COLLISION_GROUP_13
public static final int COLLISION_GROUP_14
public static final int COLLISION_GROUP_15
public static final int COLLISION_GROUP_16
public static final java.util.logging.Logger logger
protected PhysicsCollisionObject()
This no-arg constructor was made explicit to avoid javadoc warnings from JDK 18+.
public void activate(boolean forceFlag)
Deactivation doesn't affect a PhysicsCharacter or PhysicsGhostObject.
forceFlag - true to force activationpublic void addCollideWithGroup(int collisionGroup)
Two objects can collide only if one of them has the collisionGroup of the other in its collideWithGroups set.
collisionGroup - the groups to add, ORed together (bitmask)public void addToIgnoreList(PhysicsCollisionObject otherPco)
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.
otherPco - the other collision object (not null, not this,
modified)public BoundingBox boundingBox(BoundingBox storeResult)
storeResult - storage for the result (modified if not null)public void clearIgnoreList()
public int collisionFlags()
CollisionFlag.public final void copyPcoProperties(PhysicsCollisionObject old)
old - (not null, unaffected)public int countIgnored()
addToIgnoreList(com.jme3.bullet.collision.PhysicsCollisionObject)public static PhysicsCollisionObject findInstance(long pcoId)
pcoId - the native identifier (not zero)public int getActivationState()
Deactivation doesn't affect a PhysicsCharacter or PhysicsGhostObject.
Activationpublic Vector3f getAnisotropicFriction(Vector3f storeResult)
Friction doesn't affect a PhysicsCharacter or PhysicsGhostObject.
storeResult - storage for the result (modified if not null)public float getCcdMotionThreshold()
CCD doesn't affect a PhysicsCharacter or PhysicsGhostObject.
public float getCcdSquareMotionThreshold()
CCD doesn't affect a PhysicsCharacter or PhysicsGhostObject.
public float getCcdSweptSphereRadius()
CCD doesn't affect a PhysicsCharacter or PhysicsGhostObject.
public int getCollideWithGroups()
public int getCollisionGroup()
public CollisionShape getCollisionShape()
public CollisionSpace getCollisionSpace()
public float getContactDamping()
Contact damping doesn't affect a PhysicsCharacter or PhysicsGhostObject.
public float getContactProcessingThreshold()
Contact processing doesn't affect a PhysicsCharacter or PhysicsGhostObject.
public float getContactStiffness()
Contact stiffness doesn't affect a PhysicsCharacter or PhysicsGhostObject.
public float getDeactivationTime()
Deactivation doesn't affect a PhysicsCharacter or PhysicsGhostObject.
public float getFriction()
Friction doesn't affect a PhysicsCharacter or PhysicsGhostObject.
public Vector3f getPhysicsLocation(Vector3f storeResult)
storeResult - storage for the result (modified if not null)public Vec3d getPhysicsLocationDp(Vec3d storeResult)
storeResult - storage for the result (modified if not null)public Quaternion getPhysicsRotation(Quaternion storeResult)
storeResult - storage for the result (modified if not null)public Quatd getPhysicsRotationDp(Quatd storeResult)
storeResult - storage for the result (modified if not null)public Matrix3f getPhysicsRotationMatrix(Matrix3f storeResult)
storeResult - storage for the result (modified if not null)public Matrix3d getPhysicsRotationMatrixDp(Matrix3d storeResult)
storeResult - storage for the result (modified if not null)public float getRestitution()
Restitution doesn't affect a PhysicsCharacter or PhysicsGhostObject.
public float getRollingFriction()
Friction doesn't affect a PhysicsCharacter or PhysicsGhostObject.
public Vector3f getScale(Vector3f storeResult)
storeResult - storage for the result (modified if not null)public float getSpinningFriction()
Friction doesn't affect a PhysicsCharacter or PhysicsGhostObject.
public Transform getTransform(Transform storeResult)
storeResult - storage for the result (modified if not null)public TransformDp getTransformDp(TransformDp storeResult)
storeResult - storage for the result (modified if not null)public java.lang.Object getUserObject()
setUserObject(java.lang.Object)public boolean hasAnisotropicFriction(int mode)
Friction doesn't affect a PhysicsCharacter or PhysicsGhostObject.
mode - the mode(s) to test for: 1=basic anisotropic friction,
2=anisotropic rolling friction, 3=either onepublic boolean ignores(PhysicsCollisionObject other)
other - the collision object to search foraddToIgnoreList(com.jme3.bullet.collision.PhysicsCollisionObject)public boolean isActive()
Deactivation doesn't affect a PhysicsCharacter or PhysicsGhostObject.
public final boolean isContactResponse()
public final boolean isInWorld()
public final boolean isStatic()
public PhysicsCollisionObject[] listIgnoredPcos()
addToIgnoreList(com.jme3.bullet.collision.PhysicsCollisionObject)public java.lang.Integer proxyGroup()
public java.lang.Integer proxyMask()
public void removeCollideWithGroup(int collisionGroup)
collisionGroup - the groups to remove, ORed together (bitmask)public void removeFromIgnoreList(PhysicsCollisionObject otherPco)
otherPco - the other collision object (not null, not this, modified)public void setAnisotropicFriction(Vector3f components, int mode)
Friction doesn't affect a PhysicsCharacter or PhysicsGhostObject.
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)public void setCcdMotionThreshold(float threshold)
CCD addresses the issue of fast-moving bodies passing through other bodies without creating any contacts.
CCD doesn't affect a PhysicsCharacter or PhysicsGhostObject.
threshold - the desired minimum distance per simulation step to
trigger CCD (in physics-space units, >0) or zero to disable CCD
(default=0)public void setCcdSweptSphereRadius(float radius)
CCD doesn't affect a PhysicsCharacter or PhysicsGhostObject.
radius - (in physics-space units, ≥0, default=0)public void setCollideWithGroups(int collisionGroups)
collisionGroups - the desired groups, ORed together (bitmask,
default=COLLISION_GROUP_01)public void setCollisionGroup(int collisionGroup)
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.
collisionGroup - the collisionGroup to apply (bitmask with exactly
one bit set, default=COLLISION_GROUP_01)public void setCollisionShape(CollisionShape collisionShape)
collisionShape - the shape to apply (not null, alias created)public void setContactDamping(float damping)
Contact damping doesn't affect a PhysicsCharacter or PhysicsGhostObject.
damping - the desired damping (default=0.1)public void setContactProcessingThreshold(float distance)
Contact processing doesn't affect a PhysicsCharacter or PhysicsGhostObject.
distance - the desired threshold distance (in physics-space units,
default=1e18 with SP library or 1e30 with DP library)public void setContactStiffness(float stiffness)
Contact stiffness doesn't affect a PhysicsCharacter or PhysicsGhostObject.
stiffness - the desired stiffness (default=1e18 with SP library or
1e30 with DP library)public void setDeactivationTime(float time)
Deactivation doesn't affect a PhysicsCharacter or PhysicsGhostObject.
time - the desired time (in seconds, default=0)public void setFriction(float friction)
Friction doesn't affect a PhysicsCharacter or PhysicsGhostObject.
friction - the desired friction value (≥0, default=0.5)public void setIgnoreList(PhysicsCollisionObject[] desiredList)
desiredList - collision objects to ignore (not null, may be empty,
may contain nulls or duplicates or this, unaffected)public void setRestitution(float restitution)
Restitution doesn't affect a PhysicsCharacter or PhysicsGhostObject.
restitution - the desired value (default=0)public void setRollingFriction(float friction)
Friction doesn't affect a PhysicsCharacter or PhysicsGhostObject.
friction - the desired friction value (default=0)public void setSpinningFriction(float friction)
Friction doesn't affect a PhysicsCharacter or PhysicsGhostObject.
friction - the desired friction value (default=0)public void setUserIndex(int index)
index - the desired value (default=-1)public void setUserIndex2(int index)
index - the desired value (default=-1)public void setUserIndex3(int index)
index - the desired value (default=-1)public void setUserObject(java.lang.Object user)
user - the desired scene object (alias created, default=null)getUserObject()public long spaceId()
public int userIndex()
public int userIndex2()
public int userIndex3()
protected static void attachCollisionShape(long objectId,
long collisionShapeId)
objectId - the identifier of the btCollisionObject (not zero)collisionShapeId - the identifier of the btCollisionShape (not zero)protected static void finalizeNative(long objectId)
objectId - the ID of the btCollisionObject (not zero)protected static final int getInternalType(long objectId)
objectId - the ID of the btCollisionObject (not zero)PcoTypeprotected void initUserPointer()
protected static void setActivationState(long objectId,
int desiredState)
Deactivation doesn't affect a PhysicsCharacter or PhysicsGhostObject.
objectId - the ID of the btCollisionObject (not zero)desiredState - the desired stateprotected static void setCollisionFlags(long objectId,
int desiredFlags)
CollisionFlag. Native method.objectId - the ID of the btCollisionObject (not zero)desiredFlags - the desired collision flags, ORed togetherprotected void setLocationAndBasis(Vector3f centerLocation, Matrix3f orientation)
centerLocation - the desired location for this object's center (in
physics-space coordinates, not null, unaffected)orientation - the desired orientation for this object (rotation
matrix in physics-space coordinates, not null, unaffected)public java.lang.String toString()
toString in class NativePhysicsObject