Package com.jme3.bullet.objects
Class PhysicsGhostObject
java.lang.Object
com.jme3.bullet.collision.PhysicsCollisionObject
com.jme3.bullet.objects.PhysicsGhostObject
- All Implemented Interfaces:
com.jme3.export.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.
- Author:
- normenhansen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.bulletphysics.collision.dispatch.PairCachingGhostObjectprotected booleanprotected javax.vecmath.Quat4fprotected com.bulletphysics.linearmath.Transformprotected final com.jme3.math.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(com.jme3.scene.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.com.jme3.math.Vector3fcom.jme3.math.Vector3fgetPhysicsLocation(com.jme3.math.Vector3f trans) com.jme3.math.Quaternioncom.jme3.math.QuaterniongetPhysicsRotation(com.jme3.math.Quaternion rot) com.jme3.math.Matrix3fcom.jme3.math.Matrix3fgetPhysicsRotationMatrix(com.jme3.math.Matrix3f rot) com.jme3.math.Transformvoidread(com.jme3.export.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(com.jme3.math.Vector3f location) Sets the physics object locationvoidsetPhysicsRotation(com.jme3.math.Matrix3f rotation) Sets the physics object rotationvoidsetPhysicsRotation(com.jme3.math.Quaternion rotation) Sets the physics object rotationvoidwrite(com.jme3.export.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
protected final com.jme3.math.Quaternion 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
public void setPhysicsLocation(com.jme3.math.Vector3f location) Sets the physics object location- Parameters:
location- the location of the actual physics object
-
setPhysicsRotation
public void setPhysicsRotation(com.jme3.math.Matrix3f rotation) Sets the physics object rotation- Parameters:
rotation- the rotation of the actual physics object
-
setPhysicsRotation
public void setPhysicsRotation(com.jme3.math.Quaternion rotation) Sets the physics object rotation- Parameters:
rotation- the rotation of the actual physics object
-
getPhysicsTransform
public com.jme3.math.Transform getPhysicsTransform()- Returns:
- the physicsLocation
-
getPhysicsLocation
public com.jme3.math.Vector3f getPhysicsLocation(com.jme3.math.Vector3f trans) - Parameters:
trans- storage for the result (modified if not null)- Returns:
- the physicsLocation
-
getPhysicsRotation
public com.jme3.math.Quaternion getPhysicsRotation(com.jme3.math.Quaternion rot) - Parameters:
rot- storage for the result (modified if not null)- Returns:
- the physicsLocation
-
getPhysicsRotationMatrix
public com.jme3.math.Matrix3f getPhysicsRotationMatrix(com.jme3.math.Matrix3f rot) - Parameters:
rot- storage for the result (modified if not null)- Returns:
- the physicsLocation
-
getPhysicsLocation
public com.jme3.math.Vector3f getPhysicsLocation()- Returns:
- the physicsLocation
-
getPhysicsRotation
public com.jme3.math.Quaternion getPhysicsRotation()- Returns:
- the physicsLocation
-
getPhysicsRotationMatrix
public com.jme3.math.Matrix3f 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 interfacecom.jme3.export.Savable- Overrides:
writein classPhysicsCollisionObject- Throws:
IOException
-
read
- Specified by:
readin interfacecom.jme3.export.Savable- Overrides:
readin classPhysicsCollisionObject- Throws:
IOException
-