public abstract class PhysicsCollisionObject extends java.lang.Object implements Savable
Collision objects include PhysicsCharacter, PhysicsRigidBody, 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"
|
protected int |
collisionGroup
collision group to which this physics object belongs (default=group #1)
|
protected int |
collisionGroupsMask
collision groups with which this object can collide (default=only group
#1)
|
protected CollisionShape |
collisionShape
shape associated with this object (not null)
|
protected long |
objectId
Unique identifier of the btCollisionObject.
|
Constructor and Description |
---|
PhysicsCollisionObject() |
Modifier and Type | Method and Description |
---|---|
void |
addCollideWithGroup(int collisionGroup)
Add collision groups to the set with which this object can collide.
|
protected void |
attachCollisionShape(long objectId,
long collisionShapeId)
Attach the identified btCollisionShape to the identified
btCollisionObject.
|
protected void |
finalize()
Finalize this collision object just before it is destroyed.
|
protected void |
finalizeNative(long objectId)
Finalize the identified btCollisionObject.
|
int |
getCollideWithGroups()
Read the set of collision groups with which this object can collide.
|
protected int |
getCollisionFlags(long objectId)
Read the collision flags of this object.
|
int |
getCollisionGroup()
Read the collision group for this physics object.
|
CollisionShape |
getCollisionShape()
Access the shape of this physics object.
|
float |
getDeactivationTime()
Read the deactivation time.
|
long |
getObjectId()
Read the id of the btCollisionObject.
|
java.lang.Object |
getUserObject()
Access the user object associated with this collision object.
|
protected void |
initUserPointer()
Initialize the user pointer and collision-group information of this
object.
|
boolean |
isContactResponse()
Test whether this object responds to contact with other objects.
|
void |
read(JmeImporter e)
De-serialize this object, for example when loading from a J3O file.
|
void |
removeCollideWithGroup(int collisionGroup)
Remove collision groups from the set with which this object can collide.
|
void |
setCollideWithGroups(int collisionGroups)
Directly alter the collision groups with which this object can collide.
|
protected void |
setCollisionFlags(long objectId,
int desiredFlags)
Alter the collision flags of this object.
|
void |
setCollisionGroup(int collisionGroup)
Alter the collision group for this physics object.
|
void |
setCollisionShape(CollisionShape collisionShape)
Apply the specified CollisionShape to this object.
|
void |
setUserObject(java.lang.Object userObject)
Associate a user object (such as a Spatial) with this collision object.
|
void |
write(JmeExporter e)
Serialize this object, for example when saving to a J3O file.
|
protected long objectId
protected CollisionShape collisionShape
public 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
protected int collisionGroup
protected int collisionGroupsMask
public void setCollisionShape(CollisionShape collisionShape)
collisionShape
- the shape to apply (not null, alias created)public CollisionShape getCollisionShape()
public float getDeactivationTime()
public int getCollisionGroup()
public void setCollisionGroup(int collisionGroup)
Groups are represented by integer bit masks with exactly 1 bit set. Pre-made variables are available in PhysicsCollisionObject. By default, physics objects are in COLLISION_GROUP_01.
Two objects can collide only if one of them has the collisionGroup of the other in its collideWithGroups set.
collisionGroup
- the collisionGroup to apply (bit mask with exactly
1 bit set)public void addCollideWithGroup(int collisionGroup)
collisionGroup
- groups to add (bit mask)public void removeCollideWithGroup(int collisionGroup)
collisionGroup
- groups to remove, ORed together (bit mask)public void setCollideWithGroups(int collisionGroups)
collisionGroups
- desired groups, ORed together (bit mask)public int getCollideWithGroups()
protected void initUserPointer()
public java.lang.Object getUserObject()
public boolean isContactResponse()
public void setUserObject(java.lang.Object userObject)
userObject
- the object to associate with this collision object
(alias created, may be null)public long getObjectId()
protected void attachCollisionShape(long objectId, long collisionShapeId)
objectId
- the unique identifier of the btCollisionObject (not zero)collisionShapeId
- the unique identifier of the btCollisionShape
(not zero)public void write(JmeExporter e) throws java.io.IOException
public void read(JmeImporter e) throws java.io.IOException
protected int getCollisionFlags(long objectId)
objectId
- the ID of the btCollisionObject (not zero)protected void setCollisionFlags(long objectId, int desiredFlags)
objectId
- the ID of the btCollisionObject (not zero)desiredFlags
- the desired collision flags (bit mask)protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
- ignored by the garbage collectorprotected void finalizeNative(long objectId)
objectId
- the unique identifier of the btCollisionObject (not zero)