com.jme3.bullet.control
Class GhostControl

java.lang.Object
  extended by com.jme3.bullet.collision.PhysicsCollisionObject
      extended by com.jme3.bullet.objects.PhysicsGhostObject
          extended by com.jme3.bullet.control.GhostControl
All Implemented Interfaces:
PhysicsControl, Savable, Control

public class GhostControl
extends PhysicsGhostObject
implements PhysicsControl

A GhostControl moves with the spatial it is attached to and can be used to check overlaps with other physics objects (e.g. aggro radius).


Field Summary
protected  boolean added
           
protected  boolean applyLocal
           
protected  boolean enabled
           
protected  PhysicsSpace space
           
protected  Spatial spatial
           
 
Fields inherited from class com.jme3.bullet.objects.PhysicsGhostObject
locationDirty, tmp_inverseWorldRotation
 
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, debugArrow, debugArrowGeom, debugMaterialBlue, debugMaterialGreen, debugMaterialRed, debugMaterialYellow, debugShape, objectId
 
Constructor Summary
GhostControl()
           
GhostControl(CollisionShape shape)
           
 
Method Summary
 Control cloneForSpatial(Spatial spatial)
          Creates a clone of the Control, the given Spatial is the cloned version of the spatial to which this control is attached to.
 PhysicsSpace getPhysicsSpace()
           
 boolean isApplyPhysicsLocal()
           
 boolean isEnabled()
           
 void read(JmeImporter im)
           
 void render(RenderManager rm, ViewPort vp)
          Should be called prior to queuing the spatial by the RenderManager.
 void setApplyPhysicsLocal(boolean applyPhysicsLocal)
          When set to true, the physics coordinates will be applied to the local translation of the Spatial
 void setEnabled(boolean enabled)
          The physics object is removed from the physics space when the control is disabled.
 void setPhysicsSpace(PhysicsSpace space)
           
 void setSpatial(Spatial spatial)
           
 void update(float tpf)
          Updates the control.
 void write(JmeExporter ex)
           
 
Methods inherited from class com.jme3.bullet.objects.PhysicsGhostObject
buildObject, destroy, getCcdMotionThreshold, getCcdSquareMotionThreshold, getCcdSweptSphereRadius, getOverlapping, getOverlappingCount, getOverlappingObjects, getOverlappingObjects, getPhysicsLocation, getPhysicsLocation, getPhysicsRotation, getPhysicsRotation, getPhysicsRotationMatrix, getPhysicsRotationMatrix, setCcdMotionThreshold, setCcdSweptSphereRadius, setCollisionShape, setPhysicsLocation, setPhysicsRotation, setPhysicsRotation
 
Methods inherited from class com.jme3.bullet.collision.PhysicsCollisionObject
addCollideWithGroup, attachCollisionShape, attachDebugShape, attachDebugShape, attachDebugShape, createDebugShape, debugShape, detachDebugShape, finalize, finalizeNative, getCollideWithGroups, getCollisionGroup, getCollisionShape, getDebugShape, getObjectId, getUserObject, initUserPointer, removeCollideWithGroup, setCollideWithGroups, setCollisionGroup, setUserObject, updateDebugShape
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

spatial

protected Spatial spatial

enabled

protected boolean enabled

added

protected boolean added

space

protected PhysicsSpace space

applyLocal

protected boolean applyLocal
Constructor Detail

GhostControl

public GhostControl()

GhostControl

public GhostControl(CollisionShape shape)
Method Detail

isApplyPhysicsLocal

public boolean isApplyPhysicsLocal()

setApplyPhysicsLocal

public void setApplyPhysicsLocal(boolean applyPhysicsLocal)
When set to true, the physics coordinates will be applied to the local translation of the Spatial

Parameters:
applyPhysicsLocal -

cloneForSpatial

public Control cloneForSpatial(Spatial spatial)
Description copied from interface: Control
Creates a clone of the Control, the given Spatial is the cloned version of the spatial to which this control is attached to.

Specified by:
cloneForSpatial in interface Control
Returns:
A clone of this control for the spatial

setSpatial

public void setSpatial(Spatial spatial)
Specified by:
setSpatial in interface Control
Parameters:
spatial - the spatial to be controlled. This should not be called from user code.

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: PhysicsControl
The physics object is removed from the physics space when the control is disabled. When the control is enabled again the physics object is moved to the current location of the spatial and then added to the physics space. This allows disabling/enabling physics to move the spatial freely.

Specified by:
setEnabled in interface PhysicsControl

isEnabled

public boolean isEnabled()

update

public void update(float tpf)
Description copied from interface: Control
Updates the control. This should not be called from user code.

Specified by:
update in interface Control
Parameters:
tpf - Time per frame.

render

public void render(RenderManager rm,
                   ViewPort vp)
Description copied from interface: Control
Should be called prior to queuing the spatial by the RenderManager. This should not be called from user code.

Specified by:
render in interface Control

setPhysicsSpace

public void setPhysicsSpace(PhysicsSpace space)
Specified by:
setPhysicsSpace in interface PhysicsControl

getPhysicsSpace

public PhysicsSpace getPhysicsSpace()
Specified by:
getPhysicsSpace in interface PhysicsControl

write

public void write(JmeExporter ex)
           throws java.io.IOException
Specified by:
write in interface Savable
Overrides:
write in class PhysicsGhostObject
Throws:
java.io.IOException

read

public void read(JmeImporter im)
          throws java.io.IOException
Specified by:
read in interface Savable
Overrides:
read in class PhysicsGhostObject
Throws:
java.io.IOException