Package com.jme3.bullet.objects
Class PhysicsGhostObject
java.lang.Object
com.jme3.bullet.collision.PhysicsCollisionObject
com.jme3.bullet.objects.PhysicsGhostObject
- All Implemented Interfaces:
Savable
- Direct Known Subclasses:
GhostControl
From Bullet manual:
GhostObject can keep track of all objects that are overlapping. By default, this overlap is based on the AABB. This is useful for creating a character controller, collision sensors/triggers, explosions etc.
GhostObject can keep track of all objects that are overlapping. By default, this overlap is based on the AABB. This is useful for creating a character controller, collision sensors/triggers, explosions etc.
-
Field Summary
Modifier and TypeFieldDescriptionprotected com.bulletphysics.collision.dispatch.PairCachingGhostObject
protected boolean
protected javax.vecmath.Quat4f
protected com.bulletphysics.linearmath.Transform
protected final Quaternion
Fields inherited from class com.jme3.bullet.collision.PhysicsCollisionObject
COLLISION_GROUP_01, COLLISION_GROUP_02, COLLISION_GROUP_03, COLLISION_GROUP_04, COLLISION_GROUP_05, COLLISION_GROUP_06, COLLISION_GROUP_07, COLLISION_GROUP_08, COLLISION_GROUP_09, COLLISION_GROUP_10, COLLISION_GROUP_11, COLLISION_GROUP_12, COLLISION_GROUP_13, COLLISION_GROUP_14, COLLISION_GROUP_15, COLLISION_GROUP_16, COLLISION_GROUP_NONE, collisionGroup, collisionGroupsMask, collisionShape
-
Constructor Summary
ModifierConstructorDescriptionprotected
PhysicsGhostObject
(CollisionShape shape) PhysicsGhostObject
(Spatial child, CollisionShape shape) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
void
destroy()
destroys this PhysicsGhostNode and removes it from memoryfloat
float
float
com.bulletphysics.collision.dispatch.PairCachingGhostObject
used internallygetOverlapping
(int index) int
Another Object is overlapping with this GhostNode, if and if only there CollisionShapes overlaps.getPhysicsLocation
(Vector3f trans) void
read
(JmeImporter importer) void
setCcdMotionThreshold
(float threshold) void
setCcdSweptSphereRadius
(float radius) 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
setPhysicsLocation
(Vector3f location) Sets the physics object locationvoid
setPhysicsRotation
(Matrix3f rotation) Sets the physics object rotationvoid
setPhysicsRotation
(Quaternion rotation) Sets the physics object rotationvoid
write
(JmeExporter e) Methods inherited from class com.jme3.bullet.collision.PhysicsCollisionObject
addCollideWithGroup, getCollideWithGroups, getCollisionGroup, getCollisionShape, getUserObject, removeCollideWithGroup, setCollideWithGroups, setCollisionGroup, setUserObject
-
Field Details
-
gObject
protected com.bulletphysics.collision.dispatch.PairCachingGhostObject gObject -
locationDirty
protected boolean locationDirty -
tmp_inverseWorldRotation
-
tempTrans
protected com.bulletphysics.linearmath.Transform tempTrans -
tempRot
protected javax.vecmath.Quat4f tempRot
-
-
Constructor Details
-
PhysicsGhostObject
protected PhysicsGhostObject() -
PhysicsGhostObject
-
PhysicsGhostObject
-
-
Method Details
-
buildObject
protected void buildObject() -
setCollisionShape
Description copied from class:PhysicsCollisionObject
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.- Overrides:
setCollisionShape
in classPhysicsCollisionObject
- Parameters:
collisionShape
- the CollisionShape to set
-
setPhysicsLocation
Sets the physics object location- Parameters:
location
- the location of the actual physics object
-
setPhysicsRotation
Sets the physics object rotation- Parameters:
rotation
- the rotation of the actual physics object
-
setPhysicsRotation
Sets the physics object rotation- Parameters:
rotation
- the rotation of the actual physics object
-
getPhysicsTransform
- Returns:
- the physicsLocation
-
getPhysicsLocation
- Parameters:
trans
- storage for the result (modified if not null)- Returns:
- the physicsLocation
-
getPhysicsRotation
- Parameters:
rot
- storage for the result (modified if not null)- Returns:
- the physicsLocation
-
getPhysicsRotationMatrix
- Parameters:
rot
- storage for the result (modified if not null)- Returns:
- the physicsLocation
-
getPhysicsLocation
- Returns:
- the physicsLocation
-
getPhysicsRotation
- Returns:
- the physicsLocation
-
getPhysicsRotationMatrix
-
getObjectId
public com.bulletphysics.collision.dispatch.PairCachingGhostObject getObjectId()used internally- Returns:
- the pre-existing instance
-
destroy
public void destroy()destroys this PhysicsGhostNode and removes it from memory -
getOverlappingObjects
Another Object is overlapping with this GhostNode, if and if only there CollisionShapes overlaps. They could be both regular PhysicsRigidBodys or PhysicsGhostObjects.- Returns:
- All CollisionObjects overlapping with this GhostNode.
-
getOverlappingCount
public int getOverlappingCount()- Returns:
- With how many other CollisionObjects this GhostNode is currently overlapping.
-
getOverlapping
- Parameters:
index
- The index of the overlapping Node to retrieve.- Returns:
- The Overlapping CollisionObject at the given index.
-
setCcdSweptSphereRadius
public void setCcdSweptSphereRadius(float radius) -
setCcdMotionThreshold
public void setCcdMotionThreshold(float threshold) -
getCcdSweptSphereRadius
public float getCcdSweptSphereRadius() -
getCcdMotionThreshold
public float getCcdMotionThreshold() -
getCcdSquareMotionThreshold
public float getCcdSquareMotionThreshold() -
write
- Specified by:
write
in interfaceSavable
- Overrides:
write
in classPhysicsCollisionObject
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Overrides:
read
in classPhysicsCollisionObject
- Throws:
IOException
-