Package com.jme3.bullet.control
Class CharacterControl
java.lang.Object
com.jme3.bullet.collision.PhysicsCollisionObject
com.jme3.bullet.objects.PhysicsCharacter
com.jme3.bullet.control.CharacterControl
- All Implemented Interfaces:
PhysicsControl,com.jme3.export.Savable,com.jme3.scene.control.Control,com.jme3.util.clone.JmeCloneable,Cloneable
public class CharacterControl
extends PhysicsCharacter
implements PhysicsControl, com.jme3.util.clone.JmeCloneable
You might want to try
BetterCharacterControl as well.- Author:
- normenhansen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanprotected booleanprotected PhysicsSpaceprotected com.jme3.scene.Spatialprotected booleanprotected com.jme3.math.Vector3fFields inherited from class com.jme3.bullet.objects.PhysicsCharacter
character, fallSpeed, gObject, jumpSpeed, locationDirty, stepHeight, tmp_inverseWorldRotation, upAxis, walkDirectionFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcloneFields(com.jme3.util.clone.Cloner cloner, Object original) com.jme3.scene.control.ControlcloneForSpatial(com.jme3.scene.Spatial spatial) Deprecated.Access the physics space to which the object is (or would be) added.com.jme3.scene.Spatialcom.jme3.math.Vector3fbooleanbooleanTest whether this control is enabled.booleanjmeClone()voidread(com.jme3.export.JmeImporter im) voidrender(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp) voidsetApplyPhysicsLocal(boolean applyPhysicsLocal) When set to true, the physics coordinates will be applied to the local translation of the SpatialvoidsetEnabled(boolean enabled) Enable or disable this control.voidsetPhysicsSpace(PhysicsSpace newSpace) If enabled, add this control's physics object to the specified physics space.voidsetSpatial(com.jme3.scene.Spatial spatial) voidsetUseViewDirection(boolean viewDirectionEnabled) voidsetViewDirection(com.jme3.math.Vector3f vec) voidupdate(float tpf) voidwrite(com.jme3.export.JmeExporter ex) Methods inherited from class com.jme3.bullet.objects.PhysicsCharacter
buildObject, destroy, getCcdMotionThreshold, getCcdSquareMotionThreshold, getCcdSweptSphereRadius, getControllerId, getFallSpeed, getGravity, getJumpSpeed, getMaxSlope, getObjectId, getPhysicsLocation, getPhysicsLocation, getUpAxis, getWalkDirection, isContactResponse, jump, onGround, setCcdMotionThreshold, setCcdSweptSphereRadius, setCollisionShape, setContactResponse, setFallSpeed, setGravity, setJumpSpeed, setMaxSlope, setPhysicsLocation, setUpAxis, setWalkDirection, warpMethods inherited from class com.jme3.bullet.collision.PhysicsCollisionObject
addCollideWithGroup, getCollideWithGroups, getCollisionGroup, getCollisionShape, getUserObject, removeCollideWithGroup, setCollideWithGroups, setCollisionGroup, setUserObject
-
Field Details
-
spatial
protected com.jme3.scene.Spatial spatial -
enabled
protected boolean enabled -
added
protected boolean added -
space
-
viewDirection
protected com.jme3.math.Vector3f viewDirection -
useViewDirection
protected boolean useViewDirection -
applyLocal
protected boolean applyLocal
-
-
Constructor Details
-
CharacterControl
public CharacterControl() -
CharacterControl
-
-
Method Details
-
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- true→match local coordinates, false→match world coordinates (default=false)
-
cloneForSpatial
Deprecated.- Specified by:
cloneForSpatialin interfacecom.jme3.scene.control.Control
-
jmeClone
- Specified by:
jmeClonein interfacecom.jme3.util.clone.JmeCloneable
-
cloneFields
- Specified by:
cloneFieldsin interfacecom.jme3.util.clone.JmeCloneable
-
setSpatial
public void setSpatial(com.jme3.scene.Spatial spatial) - Specified by:
setSpatialin interfacecom.jme3.scene.control.Control
-
getSpatial
public com.jme3.scene.Spatial getSpatial()- Returns:
- returns the spatial the control is added to, or null if the control is not attached to a spatial yet.
-
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:PhysicsControlEnable or disable this control.The physics object is removed from its 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.
- Specified by:
setEnabledin interfacePhysicsControl- Parameters:
enabled- true→enable the control, false→disable it
-
isEnabled
public boolean isEnabled()Description copied from interface:PhysicsControlTest whether this control is enabled.- Specified by:
isEnabledin interfacePhysicsControl- Returns:
- true if enabled, otherwise false
-
setViewDirection
public void setViewDirection(com.jme3.math.Vector3f vec) -
getViewDirection
public com.jme3.math.Vector3f getViewDirection() -
isUseViewDirection
public boolean isUseViewDirection() -
setUseViewDirection
public void setUseViewDirection(boolean viewDirectionEnabled) -
update
public void update(float tpf) - Specified by:
updatein interfacecom.jme3.scene.control.Control
-
render
public void render(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp) - Specified by:
renderin interfacecom.jme3.scene.control.Control
-
setPhysicsSpace
If enabled, add this control's physics object to the specified physics space. If not enabled, alter where the object would be added. The object is removed from any other space it's currently in.- Specified by:
setPhysicsSpacein interfacePhysicsControl- Parameters:
newSpace- where to add, or null to simply remove
-
getPhysicsSpace
Description copied from interface:PhysicsControlAccess the physics space to which the object is (or would be) added.- Specified by:
getPhysicsSpacein interfacePhysicsControl- Returns:
- the pre-existing space, or null for none
-
write
- Specified by:
writein interfacecom.jme3.export.Savable- Overrides:
writein classPhysicsCharacter- Throws:
IOException
-
read
- Specified by:
readin interfacecom.jme3.export.Savable- Overrides:
readin classPhysicsCharacter- Throws:
IOException
-