Class PhysicsGhostObject

java.lang.Object
com.jme3.bullet.collision.PhysicsCollisionObject
com.jme3.bullet.objects.PhysicsGhostObject
All Implemented Interfaces:
Savable
Direct Known Subclasses:
GhostControl

public class PhysicsGhostObject extends PhysicsCollisionObject
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.
  • Field Details

    • gObject

      protected com.bulletphysics.collision.dispatch.PairCachingGhostObject gObject
    • locationDirty

      protected boolean locationDirty
    • tmp_inverseWorldRotation

      protected final Quaternion tmp_inverseWorldRotation
    • tempTrans

      protected com.bulletphysics.linearmath.Transform tempTrans
    • tempRot

      protected javax.vecmath.Quat4f tempRot
  • Constructor Details

    • PhysicsGhostObject

      protected PhysicsGhostObject()
    • PhysicsGhostObject

      public PhysicsGhostObject(CollisionShape shape)
    • PhysicsGhostObject

      public PhysicsGhostObject(Spatial child, CollisionShape shape)
  • Method Details

    • buildObject

      protected void buildObject()
    • setCollisionShape

      public void setCollisionShape(CollisionShape collisionShape)
      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 class PhysicsCollisionObject
      Parameters:
      collisionShape - the CollisionShape to set
    • setPhysicsLocation

      public void setPhysicsLocation(Vector3f location)
      Sets the physics object location
      Parameters:
      location - the location of the actual physics object
    • setPhysicsRotation

      public void setPhysicsRotation(Matrix3f rotation)
      Sets the physics object rotation
      Parameters:
      rotation - the rotation of the actual physics object
    • setPhysicsRotation

      public void setPhysicsRotation(Quaternion rotation)
      Sets the physics object rotation
      Parameters:
      rotation - the rotation of the actual physics object
    • getPhysicsTransform

      public Transform getPhysicsTransform()
      Returns:
      the physicsLocation
    • getPhysicsLocation

      public Vector3f getPhysicsLocation(Vector3f trans)
      Parameters:
      trans - storage for the result (modified if not null)
      Returns:
      the physicsLocation
    • getPhysicsRotation

      public Quaternion getPhysicsRotation(Quaternion rot)
      Parameters:
      rot - storage for the result (modified if not null)
      Returns:
      the physicsLocation
    • getPhysicsRotationMatrix

      public Matrix3f getPhysicsRotationMatrix(Matrix3f rot)
      Parameters:
      rot - storage for the result (modified if not null)
      Returns:
      the physicsLocation
    • getPhysicsLocation

      public Vector3f getPhysicsLocation()
      Returns:
      the physicsLocation
    • getPhysicsRotation

      public Quaternion getPhysicsRotation()
      Returns:
      the physicsLocation
    • getPhysicsRotationMatrix

      public 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

      public List<PhysicsCollisionObject> 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

      public PhysicsCollisionObject getOverlapping(int index)
      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

      public void write(JmeExporter e) throws IOException
      Specified by:
      write in interface Savable
      Overrides:
      write in class PhysicsCollisionObject
      Throws:
      IOException
    • read

      public void read(JmeImporter importer) throws IOException
      Specified by:
      read in interface Savable
      Overrides:
      read in class PhysicsCollisionObject
      Throws:
      IOException