public class CharacterControl extends PhysicsCharacter implements PhysicsControl, JmeCloneable
BetterCharacterControl
as well.Modifier and Type | Field and Description |
---|---|
protected boolean |
added |
protected boolean |
applyLocal |
protected boolean |
enabled |
protected PhysicsSpace |
space |
protected Spatial |
spatial |
protected boolean |
useViewDirection |
protected Vector3f |
viewDirection |
character, fallSpeed, gObject, jumpSpeed, locationDirty, stepHeight, tmp_inverseWorldRotation, upAxis, walkDirection
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 and Description |
---|
CharacterControl() |
CharacterControl(CollisionShape shape,
float stepHeight) |
Modifier and Type | Method and Description |
---|---|
void |
cloneFields(Cloner cloner,
java.lang.Object original)
Implemented to perform deep cloning for this object, resolving
local cloned references using the specified cloner.
|
Control |
cloneForSpatial(Spatial spatial)
Deprecated.
|
PhysicsSpace |
getPhysicsSpace()
Access the physics space to which the object is (or would be) added.
|
Spatial |
getSpatial() |
Vector3f |
getViewDirection() |
boolean |
isApplyPhysicsLocal() |
boolean |
isEnabled()
Test whether this control is enabled.
|
boolean |
isUseViewDirection() |
java.lang.Object |
jmeClone()
Performs a regular shallow clone of the object.
|
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)
Enable or disable this control.
|
void |
setPhysicsSpace(PhysicsSpace newSpace)
If enabled, add this control's physics object to the specified physics
space.
|
void |
setSpatial(Spatial spatial) |
void |
setUseViewDirection(boolean viewDirectionEnabled) |
void |
setViewDirection(Vector3f vec) |
void |
update(float tpf)
Updates the control.
|
void |
write(JmeExporter ex) |
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, warp
addCollideWithGroup, getCollideWithGroups, getCollisionGroup, getCollisionShape, getUserObject, removeCollideWithGroup, setCollideWithGroups, setCollisionGroup, setUserObject
protected Spatial spatial
protected boolean enabled
protected boolean added
protected PhysicsSpace space
protected Vector3f viewDirection
protected boolean useViewDirection
protected boolean applyLocal
public CharacterControl()
public CharacterControl(CollisionShape shape, float stepHeight)
public boolean isApplyPhysicsLocal()
public void setApplyPhysicsLocal(boolean applyPhysicsLocal)
applyPhysicsLocal
- @Deprecated public Control cloneForSpatial(Spatial spatial)
Control
cloneForSpatial
in interface Control
spatial
- the Spatial to be controlled by the clonepublic java.lang.Object jmeClone()
JmeCloneable
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.
jmeClone
in interface JmeCloneable
public void cloneFields(Cloner cloner, java.lang.Object original)
JmeCloneable
Note: during normal clone operations the original object will not be needed as the clone has already had all of the fields shallow copied.
cloneFields
in interface JmeCloneable
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 merely clone what it wants.public void setSpatial(Spatial spatial)
setSpatial
in interface Control
spatial
- the spatial to be controlled. This should not be called
from user code.public Spatial getSpatial()
public void setEnabled(boolean enabled)
PhysicsControl
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.
setEnabled
in interface PhysicsControl
enabled
- true→enable the control, false→disable itpublic boolean isEnabled()
PhysicsControl
isEnabled
in interface PhysicsControl
public void setViewDirection(Vector3f vec)
public Vector3f getViewDirection()
public boolean isUseViewDirection()
public void setUseViewDirection(boolean viewDirectionEnabled)
public void update(float tpf)
Control
public void render(RenderManager rm, ViewPort vp)
Control
public void setPhysicsSpace(PhysicsSpace newSpace)
setPhysicsSpace
in interface PhysicsControl
newSpace
- where to add, or null to simply removepublic PhysicsSpace getPhysicsSpace()
PhysicsControl
getPhysicsSpace
in interface PhysicsControl
public void write(JmeExporter ex) throws java.io.IOException
write
in interface Savable
write
in class PhysicsCharacter
java.io.IOException
public void read(JmeImporter im) throws java.io.IOException
read
in interface Savable
read
in class PhysicsCharacter
java.io.IOException