Class PhysicsCollisionObject
- All Implemented Interfaces:
Comparable<NativePhysicsObject>
- Direct Known Subclasses:
MultiBodyCollider
,PhysicsBody
,PhysicsCharacter
,PhysicsGhostObject
btCollisionObject
.
Subclasses include MultiBodyCollider, PhysicsBody, PhysicsCharacter, and PhysicsGhostObject.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
collisionGroup/collideWithGroups bitmask that represents group #1static final int
collisionGroup/collideWithGroups bitmask that represents group #2static final int
collisionGroup/collideWithGroups bitmask that represents group #3static final int
collisionGroup/collideWithGroups bitmask that represents group #4static final int
collisionGroup/collideWithGroups bitmask that represents group #5static final int
collisionGroup/collideWithGroups bitmask that represents group #6static final int
collisionGroup/collideWithGroups bitmask that represents group #7static final int
collisionGroup/collideWithGroups bitmask that represents group #8static final int
collisionGroup/collideWithGroups bitmask that represents group #9static final int
collisionGroup/collideWithGroups bitmask that represents group #10static final int
collisionGroup/collideWithGroups bitmask that represents group #11static final int
collisionGroup/collideWithGroups bitmask that represents group #12static final int
collisionGroup/collideWithGroups bitmask that represents group #13static final int
collisionGroup/collideWithGroups bitmask that represents group #14static final int
collisionGroup/collideWithGroups bitmask that represents group #15static final int
collisionGroup/collideWithGroups bitmask that represents group #16static final int
collideWithGroups bitmask that represents "no groups"static final Logger
message logger for this classFields inherited from class com.jme3.bullet.NativePhysicsObject
loggerN
-
Constructor Summary
ModifierConstructorDescriptionprotected
Instantiate a collision object with no tracker and no assigned native object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
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 identifiedbtCollisionShape
to the identifiedbtCollisionObject
.boundingBox
(BoundingBox storeResult) Calculate an axis-aligned bounding box for this object, based on its collision shape.void
Clear this object's 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.protected static void
finalizeNative
(long objectId) Finalize the identified btCollisionObject.static PhysicsCollisionObject
findInstance
(long pcoId) Find the collision object with the specified ID.int
Return this object's activation state (native field: m_activationState1).getAnisotropicFriction
(Vector3f storeResult) Copy this object's anisotropic friction components (native field: m_anisotropicFriction).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).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.getPhysicsLocation
(Vector3f storeResult) Locate the collision object's center.getPhysicsLocationDp
(Vec3d storeResult) Locate the collision object's center in double precision.getPhysicsRotation
(Quaternion storeResult) Copy the orientation (rotation) of the collision object to a Quaternion.getPhysicsRotationDp
(Quatd storeResult) Copy the orientation (rotation) of this object to a Quatd.getPhysicsRotationMatrix
(Matrix3f storeResult) Copy the orientation of the collision object (the basis of its local coordinate system) to a Matrix3f.getPhysicsRotationMatrixDp
(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).Copy the scale of this object.float
Return this object's spinning friction (native field: m_spinningFriction).getTransform
(Transform storeResult) Copy the coordinate transform of this object, including the scale of its shape.getTransformDp
(TransformDp storeResult) Copy the coordinate transform of this object, including the scale of its shape.Access the "user" of this collision object.boolean
hasAnisotropicFriction
(int mode) Test whether the collision object has anisotropic friction.boolean
ignores
(PhysicsCollisionObject other) 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
isActive()
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
isStatic()
Test whether the collision object is static (immobile).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
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 the collision 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 the collision 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 the collision 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 the collision object's friction (native field: m_friction).void
setIgnoreList
(PhysicsCollisionObject[] desiredList) Replace the ignore list.protected void
setLocationAndBasis
(Vector3f centerLocation, 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
setUserObject
(Object user) Associate a "user" with the collision object.long
spaceId()
Return the ID of the space where the collision object is added.toString()
Represent the collision object as aString
.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).Methods inherited from class com.jme3.bullet.NativePhysicsObject
compareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeId, setNativeIdNotTracked, unassignNativeObject
-
Field Details
-
COLLISION_GROUP_NONE
public static final int COLLISION_GROUP_NONEcollideWithGroups bitmask that represents "no groups"- See Also:
-
COLLISION_GROUP_01
public static final int COLLISION_GROUP_01collisionGroup/collideWithGroups bitmask that represents group #1- See Also:
-
COLLISION_GROUP_02
public static final int COLLISION_GROUP_02collisionGroup/collideWithGroups bitmask that represents group #2- See Also:
-
COLLISION_GROUP_03
public static final int COLLISION_GROUP_03collisionGroup/collideWithGroups bitmask that represents group #3- See Also:
-
COLLISION_GROUP_04
public static final int COLLISION_GROUP_04collisionGroup/collideWithGroups bitmask that represents group #4- See Also:
-
COLLISION_GROUP_05
public static final int COLLISION_GROUP_05collisionGroup/collideWithGroups bitmask that represents group #5- See Also:
-
COLLISION_GROUP_06
public static final int COLLISION_GROUP_06collisionGroup/collideWithGroups bitmask that represents group #6- See Also:
-
COLLISION_GROUP_07
public static final int COLLISION_GROUP_07collisionGroup/collideWithGroups bitmask that represents group #7- See Also:
-
COLLISION_GROUP_08
public static final int COLLISION_GROUP_08collisionGroup/collideWithGroups bitmask that represents group #8- See Also:
-
COLLISION_GROUP_09
public static final int COLLISION_GROUP_09collisionGroup/collideWithGroups bitmask that represents group #9- See Also:
-
COLLISION_GROUP_10
public static final int COLLISION_GROUP_10collisionGroup/collideWithGroups bitmask that represents group #10- See Also:
-
COLLISION_GROUP_11
public static final int COLLISION_GROUP_11collisionGroup/collideWithGroups bitmask that represents group #11- See Also:
-
COLLISION_GROUP_12
public static final int COLLISION_GROUP_12collisionGroup/collideWithGroups bitmask that represents group #12- See Also:
-
COLLISION_GROUP_13
public static final int COLLISION_GROUP_13collisionGroup/collideWithGroups bitmask that represents group #13- See Also:
-
COLLISION_GROUP_14
public static final int COLLISION_GROUP_14collisionGroup/collideWithGroups bitmask that represents group #14- See Also:
-
COLLISION_GROUP_15
public static final int COLLISION_GROUP_15collisionGroup/collideWithGroups bitmask that represents group #15- See Also:
-
COLLISION_GROUP_16
public static final int COLLISION_GROUP_16collisionGroup/collideWithGroups bitmask that represents group #16- See Also:
-
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
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, notthis
, modified)
-
boundingBox
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 inCollisionFlag
.- Returns:
- the values of all flags that are set, ORed together
-
copyPcoProperties
Copy common properties from another collision object.- 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:
-
findInstance
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
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)
-
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
Access the shape of the collision object.- Returns:
- the pre-existing instance, or null if none
-
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)
-
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
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
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
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
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
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
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
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
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)
-
getTransformDp
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
Access the "user" of this collision object.- 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
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
Enumerate all collision objects in this object's ignore list.- Returns:
- a new array (not null, may be empty)
- See Also:
-
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
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
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
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)
-
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
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)
-
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
Replace the ignore list.- Parameters:
desiredList
- collision objects to ignore (not null, may be empty, may contain nulls or duplicates orthis
, 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
Associate a "user" with the collision object.- 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 identifiedbtCollisionShape
to the identifiedbtCollisionObject
. Native method.- Parameters:
objectId
- the identifier of the btCollisionObject (not zero)collisionShapeId
- the identifier of the btCollisionShape (not zero)
-
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). -
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). Flag values are defined inCollisionFlag
. Native method.- Parameters:
objectId
- the ID of the btCollisionObject (not zero)desiredFlags
- the desired collision flags, ORed together
-
setLocationAndBasis
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)
-
toString
Represent the collision object as aString
.- Overrides:
toString
in classNativePhysicsObject
- Returns:
- a descriptive string of text (not null, not empty)
-