Package com.jme3.bullet.collision
Class PhysicsCollisionObject
java.lang.Object
com.jme3.bullet.collision.PhysicsCollisionObject
- All Implemented Interfaces:
Savable
- Direct Known Subclasses:
PhysicsCharacter
,PhysicsGhostObject
,PhysicsRigidBody
Base class for collision objects (PhysicsRigidBody, PhysicsGhostObject)
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
protected int
protected int
protected CollisionShape
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCollideWithGroup
(int collisionGroup) Add a group that this object will collide with.
Two object will collide when one of the parties has the collisionGroup of the other in its collideWithGroups set.int
Gets the bitmask of collision groups that this object collides with.int
Returns the collision group for this collision shapevoid
read
(JmeImporter importer) void
removeCollideWithGroup
(int collisionGroup) Remove a group from the list this object collides with.void
setCollideWithGroups
(int collisionGroups) Directly set the bitmask for collision groups that this object collides with.void
setCollisionGroup
(int collisionGroup) Sets the collision group number for this physics object.void
setCollisionShape
(CollisionShape collisionShape) Sets a CollisionShape to this physics object, note that the object should not be in the physics space when adding a new collision shape as it is rebuilt on the physics side.void
setUserObject
(Object userObject) void
write
(JmeExporter e)
-
Field Details
-
collisionShape
-
COLLISION_GROUP_NONE
public static final int COLLISION_GROUP_NONE- See Also:
-
COLLISION_GROUP_01
public static final int COLLISION_GROUP_01- See Also:
-
COLLISION_GROUP_02
public static final int COLLISION_GROUP_02- See Also:
-
COLLISION_GROUP_03
public static final int COLLISION_GROUP_03- See Also:
-
COLLISION_GROUP_04
public static final int COLLISION_GROUP_04- See Also:
-
COLLISION_GROUP_05
public static final int COLLISION_GROUP_05- See Also:
-
COLLISION_GROUP_06
public static final int COLLISION_GROUP_06- See Also:
-
COLLISION_GROUP_07
public static final int COLLISION_GROUP_07- See Also:
-
COLLISION_GROUP_08
public static final int COLLISION_GROUP_08- See Also:
-
COLLISION_GROUP_09
public static final int COLLISION_GROUP_09- See Also:
-
COLLISION_GROUP_10
public static final int COLLISION_GROUP_10- See Also:
-
COLLISION_GROUP_11
public static final int COLLISION_GROUP_11- See Also:
-
COLLISION_GROUP_12
public static final int COLLISION_GROUP_12- See Also:
-
COLLISION_GROUP_13
public static final int COLLISION_GROUP_13- See Also:
-
COLLISION_GROUP_14
public static final int COLLISION_GROUP_14- See Also:
-
COLLISION_GROUP_15
public static final int COLLISION_GROUP_15- See Also:
-
COLLISION_GROUP_16
public static final int COLLISION_GROUP_16- See Also:
-
collisionGroup
protected int collisionGroup -
collisionGroupsMask
protected int collisionGroupsMask
-
-
Constructor Details
-
PhysicsCollisionObject
public PhysicsCollisionObject()
-
-
Method Details
-
setCollisionShape
Sets a CollisionShape to this physics object, note that the object should not be in the physics space when adding a new collision shape as it is rebuilt on the physics side.- Parameters:
collisionShape
- the CollisionShape to set
-
getCollisionShape
- Returns:
- the CollisionShape of this PhysicsNode, to be able to reuse it with other physics nodes (increases performance)
-
getCollisionGroup
public int getCollisionGroup()Returns the collision group for this collision shape- Returns:
- a bitmask with 1 bit set
-
setCollisionGroup
public void setCollisionGroup(int collisionGroup) Sets the collision group number for this physics object.
The groups are integer bit masks and some pre-made variables are available in CollisionObject. All physics objects are by default in COLLISION_GROUP_01.
Two object will collide when one of the parties has the collisionGroup of the other in its collideWithGroups set.- Parameters:
collisionGroup
- the collisionGroup to set
-
addCollideWithGroup
public void addCollideWithGroup(int collisionGroup) Add a group that this object will collide with.
Two object will collide when one of the parties has the collisionGroup of the other in its collideWithGroups set.- Parameters:
collisionGroup
- the groups to add, ORed together (bitmask)
-
removeCollideWithGroup
public void removeCollideWithGroup(int collisionGroup) Remove a group from the list this object collides with.- Parameters:
collisionGroup
- the groups to remove, ORed together (bitmask)
-
setCollideWithGroups
public void setCollideWithGroups(int collisionGroups) Directly set the bitmask for collision groups that this object collides with.- Parameters:
collisionGroups
- the desired groups, ORed together (bitmask, default=COLLISION_GROUP_01)
-
getCollideWithGroups
public int getCollideWithGroups()Gets the bitmask of collision groups that this object collides with.- Returns:
- a bitmask
-
getUserObject
- Returns:
- the userObject
-
setUserObject
- Parameters:
userObject
- the userObject to set
-
write
- Specified by:
write
in interfaceSavable
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Throws:
IOException
-