Class CharacterControl
- All Implemented Interfaces:
- PhysicsControl,- Savable,- Control,- JmeCloneable,- Cloneable
BetterCharacterControl as well.- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanprotected booleanprotected PhysicsSpaceprotected Spatialprotected booleanprotected Vector3fFields inherited from class com.jme3.bullet.objects.PhysicsCharactercharacter, fallSpeed, gObject, jumpSpeed, locationDirty, stepHeight, tmp_inverseWorldRotation, upAxis, walkDirectionFields inherited from class com.jme3.bullet.collision.PhysicsCollisionObjectCOLLISION_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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidcloneFields(Cloner cloner, Object original) Implemented to perform deep cloning for this object, resolving local cloned references using the specified cloner.cloneForSpatial(Spatial spatial) Deprecated.Access the physics space to which the object is (or would be) added.booleanbooleanTest whether this control is enabled.booleanjmeClone()Performs a regular shallow clone of the object.voidread(JmeImporter im) voidrender(RenderManager rm, ViewPort vp) Should be called prior to queuing the spatial by the RenderManager.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(Spatial spatial) voidsetUseViewDirection(boolean viewDirectionEnabled) voidsetViewDirection(Vector3f vec) voidupdate(float tpf) Updates the control.voidwrite(JmeExporter ex) Methods inherited from class com.jme3.bullet.objects.PhysicsCharacterbuildObject, 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.PhysicsCollisionObjectaddCollideWithGroup, getCollideWithGroups, getCollisionGroup, getCollisionShape, getUserObject, removeCollideWithGroup, setCollideWithGroups, setCollisionGroup, setUserObject
- 
Field Details- 
spatial
- 
enabledprotected boolean enabled
- 
addedprotected boolean added
- 
space
- 
viewDirection
- 
useViewDirectionprotected boolean useViewDirection
- 
applyLocalprotected boolean applyLocal
 
- 
- 
Constructor Details- 
CharacterControlpublic CharacterControl()
- 
CharacterControl
 
- 
- 
Method Details- 
isApplyPhysicsLocalpublic boolean isApplyPhysicsLocal()
- 
setApplyPhysicsLocalpublic 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)
 
- 
cloneForSpatialDeprecated.Description copied from interface:ControlCreates a clone of the Control, the given Spatial is the cloned version of the spatial to which this control is attached to.- Specified by:
- cloneForSpatialin interface- Control
- Parameters:
- spatial- the Spatial to be controlled by the clone
- Returns:
- A clone of this control for the spatial
 
- 
jmeCloneDescription copied from interface:JmeCloneablePerforms a regular shallow clone of the object. Some fields may also be cloned but generally only if they will never be shared with other objects. (For example, local Vector3fs and so on.)This method is separate from the regular clone() method so that objects might still maintain their own regular java clone() semantics (perhaps even using Cloner for those methods). However, because Java's clone() has specific features in the sense of Object's clone() implementation, it's usually best to have some path for subclasses to bypass the public clone() method that might be cloning fields and instead get at the superclass protected clone() methods. For example, through super.jmeClone() or another protected clone method that some base class eventually calls super.clone() in. - Specified by:
- jmeClonein interface- JmeCloneable
- Returns:
- a new instance
 
- 
cloneFieldsDescription copied from interface:JmeCloneableImplemented to perform deep cloning for this object, resolving local cloned references using the specified cloner. The object can call cloner.clone(fieldValue) to deep clone any of its fields.Note: during normal clone operations the original object will not be needed as the clone has already had all of the fields shallow copied. - Specified by:
- cloneFieldsin interface- JmeCloneable
- Parameters:
- cloner- The cloner that is performing the cloning operation. The cloneFields method can call back into the cloner to make clones of its subordinate fields.
- original- The original object from which this object was cloned. This is provided for the very rare case that this object needs to refer to its original for some reason. In general, all of the relevant values should have been transferred during the shallow clone, and this object need only clone what it wants.
 
- 
setSpatial- Specified by:
- setSpatialin interface- Control
- Parameters:
- spatial- the spatial to be controlled. This should not be called from user code.
 
- 
getSpatial- Returns:
- returns the spatial the control is added to, or null if the control is not attached to a spatial yet.
 
- 
setEnabledpublic 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 interface- PhysicsControl
- Parameters:
- enabled- true→enable the control, false→disable it
 
- 
isEnabledpublic boolean isEnabled()Description copied from interface:PhysicsControlTest whether this control is enabled.- Specified by:
- isEnabledin interface- PhysicsControl
- Returns:
- true if enabled, otherwise false
 
- 
setViewDirection
- 
getViewDirection
- 
isUseViewDirectionpublic boolean isUseViewDirection()
- 
setUseViewDirectionpublic void setUseViewDirection(boolean viewDirectionEnabled) 
- 
updatepublic void update(float tpf) Description copied from interface:ControlUpdates the control. This should not be called from user code.
- 
renderDescription copied from interface:ControlShould be called prior to queuing the spatial by the RenderManager. This should not be called from user code.
- 
setPhysicsSpaceIf 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 interface- PhysicsControl
- Parameters:
- newSpace- where to add, or null to simply remove
 
- 
getPhysicsSpaceDescription copied from interface:PhysicsControlAccess the physics space to which the object is (or would be) added.- Specified by:
- getPhysicsSpacein interface- PhysicsControl
- Returns:
- the pre-existing space, or null for none
 
- 
write- Specified by:
- writein interface- Savable
- Overrides:
- writein class- PhysicsCharacter
- Throws:
- IOException
 
- 
read- Specified by:
- readin interface- Savable
- Overrides:
- readin class- PhysicsCharacter
- Throws:
- IOException
 
 
-