com.jme3.bullet.collision
Class PhysicsCollisionObject

java.lang.Object
  extended by com.jme3.bullet.collision.PhysicsCollisionObject
All Implemented Interfaces:
Savable
Direct Known Subclasses:
PhysicsCharacter, PhysicsGhostObject, PhysicsRigidBody

public abstract class PhysicsCollisionObject
extends java.lang.Object
implements Savable

Base class for collision objects (PhysicsRigidBody, PhysicsGhostObject)


Field Summary
static int COLLISION_GROUP_01
           
static int COLLISION_GROUP_02
           
static int COLLISION_GROUP_03
           
static int COLLISION_GROUP_04
           
static int COLLISION_GROUP_05
           
static int COLLISION_GROUP_06
           
static int COLLISION_GROUP_07
           
static int COLLISION_GROUP_08
           
static int COLLISION_GROUP_09
           
static int COLLISION_GROUP_10
           
static int COLLISION_GROUP_11
           
static int COLLISION_GROUP_12
           
static int COLLISION_GROUP_13
           
static int COLLISION_GROUP_14
           
static int COLLISION_GROUP_15
           
static int COLLISION_GROUP_16
           
static int COLLISION_GROUP_NONE
           
protected  int collisionGroup
           
protected  int collisionGroupsMask
           
protected  CollisionShape collisionShape
           
protected  Arrow debugArrow
           
protected  Geometry debugArrowGeom
           
protected  Material debugMaterialBlue
           
protected  Material debugMaterialGreen
           
protected  Material debugMaterialRed
           
protected  Material debugMaterialYellow
           
protected  Spatial debugShape
           
protected  long objectId
           
 
Constructor Summary
PhysicsCollisionObject()
           
 
Method Summary
 void addCollideWithGroup(int collisionGroup)
          Add a group that this object will collide with.
Two object will collide when one of the partys has the collisionGroup of the other in its collideWithGroups set.
protected  void attachCollisionShape(long objectId, long collisionShapeId)
           
protected  Spatial attachDebugShape()
          Creates a visual debug shape of the current collision shape of this physics object
Does not work with detached physics, please switch to PARALLEL or SEQUENTIAL for debugging
protected  Spatial attachDebugShape(AssetManager manager)
          Creates a visual debug shape of the current collision shape of this physics object
Does not work with detached physics, please switch to PARALLEL or SEQUENTIAL for debugging
protected  Spatial attachDebugShape(Material material)
           
 Spatial createDebugShape(AssetManager manager)
          Creates a debug shape for this CollisionObject
 Spatial debugShape()
           
 void detachDebugShape()
          Removes the debug shape
protected  void finalize()
           
protected  void finalizeNative(long objectId)
           
 int getCollideWithGroups()
          Gets the bitmask of collision groups that this object collides with.
 int getCollisionGroup()
          Returns the collision group for this collision shape
 CollisionShape getCollisionShape()
           
protected  Spatial getDebugShape()
           
 long getObjectId()
           
 java.lang.Object getUserObject()
           
protected  void initUserPointer()
           
 void read(JmeImporter e)
           
 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(java.lang.Object userObject)
           
protected  void updateDebugShape()
           
 void write(JmeExporter e)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objectId

protected long objectId

debugShape

protected Spatial debugShape

debugArrow

protected Arrow debugArrow

debugArrowGeom

protected Geometry debugArrowGeom

debugMaterialBlue

protected Material debugMaterialBlue

debugMaterialRed

protected Material debugMaterialRed

debugMaterialGreen

protected Material debugMaterialGreen

debugMaterialYellow

protected Material debugMaterialYellow

collisionShape

protected CollisionShape collisionShape

COLLISION_GROUP_NONE

public static final int COLLISION_GROUP_NONE
See Also:
Constant Field Values

COLLISION_GROUP_01

public static final int COLLISION_GROUP_01
See Also:
Constant Field Values

COLLISION_GROUP_02

public static final int COLLISION_GROUP_02
See Also:
Constant Field Values

COLLISION_GROUP_03

public static final int COLLISION_GROUP_03
See Also:
Constant Field Values

COLLISION_GROUP_04

public static final int COLLISION_GROUP_04
See Also:
Constant Field Values

COLLISION_GROUP_05

public static final int COLLISION_GROUP_05
See Also:
Constant Field Values

COLLISION_GROUP_06

public static final int COLLISION_GROUP_06
See Also:
Constant Field Values

COLLISION_GROUP_07

public static final int COLLISION_GROUP_07
See Also:
Constant Field Values

COLLISION_GROUP_08

public static final int COLLISION_GROUP_08
See Also:
Constant Field Values

COLLISION_GROUP_09

public static final int COLLISION_GROUP_09
See Also:
Constant Field Values

COLLISION_GROUP_10

public static final int COLLISION_GROUP_10
See Also:
Constant Field Values

COLLISION_GROUP_11

public static final int COLLISION_GROUP_11
See Also:
Constant Field Values

COLLISION_GROUP_12

public static final int COLLISION_GROUP_12
See Also:
Constant Field Values

COLLISION_GROUP_13

public static final int COLLISION_GROUP_13
See Also:
Constant Field Values

COLLISION_GROUP_14

public static final int COLLISION_GROUP_14
See Also:
Constant Field Values

COLLISION_GROUP_15

public static final int COLLISION_GROUP_15
See Also:
Constant Field Values

COLLISION_GROUP_16

public static final int COLLISION_GROUP_16
See Also:
Constant Field Values

collisionGroup

protected int collisionGroup

collisionGroupsMask

protected int collisionGroupsMask
Constructor Detail

PhysicsCollisionObject

public PhysicsCollisionObject()
Method Detail

setCollisionShape

public 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.

Parameters:
collisionShape - the CollisionShape to set

getCollisionShape

public CollisionShape 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:
The collision group

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 partys 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 partys has the collisionGroup of the other in its collideWithGroups set.

Parameters:
collisionGroup -

removeCollideWithGroup

public void removeCollideWithGroup(int collisionGroup)
Remove a group from the list this object collides with.

Parameters:
collisionGroup -

setCollideWithGroups

public void setCollideWithGroups(int collisionGroups)
Directly set the bitmask for collision groups that this object collides with.

Parameters:
collisionGroups -

getCollideWithGroups

public int getCollideWithGroups()
Gets the bitmask of collision groups that this object collides with.

Returns:
Collision groups mask

initUserPointer

protected void initUserPointer()

attachDebugShape

protected Spatial attachDebugShape(AssetManager manager)
Creates a visual debug shape of the current collision shape of this physics object
Does not work with detached physics, please switch to PARALLEL or SEQUENTIAL for debugging

Parameters:
manager - AssetManager to load the default wireframe material for the debug shape

createDebugShape

public Spatial createDebugShape(AssetManager manager)
Creates a debug shape for this CollisionObject

Parameters:
manager -
Returns:
The created debug shape

attachDebugShape

protected Spatial attachDebugShape(Material material)

debugShape

public Spatial debugShape()

attachDebugShape

protected Spatial attachDebugShape()
Creates a visual debug shape of the current collision shape of this physics object
Does not work with detached physics, please switch to PARALLEL or SEQUENTIAL for debugging

Parameters:
material - Material to use for the debug shape

updateDebugShape

protected void updateDebugShape()

getDebugShape

protected Spatial getDebugShape()

detachDebugShape

public void detachDebugShape()
Removes the debug shape


getUserObject

public java.lang.Object getUserObject()
Returns:
the userObject

setUserObject

public void setUserObject(java.lang.Object userObject)
Parameters:
userObject - the userObject to set

getObjectId

public long getObjectId()

attachCollisionShape

protected void attachCollisionShape(long objectId,
                                    long collisionShapeId)

write

public void write(JmeExporter e)
           throws java.io.IOException
Specified by:
write in interface Savable
Throws:
java.io.IOException

read

public void read(JmeImporter e)
          throws java.io.IOException
Specified by:
read in interface Savable
Throws:
java.io.IOException

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

finalizeNative

protected void finalizeNative(long objectId)