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
FieldsModifier and TypeFieldDescriptionprotected com.bulletphysics.collision.dispatch.PairCachingGhostObjectprotected booleanprotected javax.vecmath.Quat4fprotected com.bulletphysics.linearmath.Transformprotected final QuaternionFields 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
ConstructorsModifierConstructorDescriptionprotectedPhysicsGhostObject(CollisionShape shape) PhysicsGhostObject(Spatial child, CollisionShape shape) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidvoiddestroy()destroys this PhysicsGhostNode and removes it from memoryfloatfloatfloatcom.bulletphysics.collision.dispatch.PairCachingGhostObjectused internallygetOverlapping(int index) intAnother Object is overlapping with this GhostNode, if and if only there CollisionShapes overlaps.getPhysicsLocation(Vector3f trans) voidread(JmeImporter importer) voidsetCcdMotionThreshold(float threshold) voidsetCcdSweptSphereRadius(float radius) voidsetCollisionShape(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.voidsetPhysicsLocation(Vector3f location) Sets the physics object locationvoidsetPhysicsRotation(Matrix3f rotation) Sets the physics object rotationvoidsetPhysicsRotation(Quaternion rotation) Sets the physics object rotationvoidwrite(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:PhysicsCollisionObjectSets 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:
setCollisionShapein 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:
writein interfaceSavable- Overrides:
writein classPhysicsCollisionObject- Throws:
IOException
-
read
- Specified by:
readin interfaceSavable- Overrides:
readin classPhysicsCollisionObject- Throws:
IOException
-