public class VehicleControl extends PhysicsVehicle implements PhysicsControl, JmeCloneable
This class is shared between JBullet and Native Bullet.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
added
true→vehicle is added to the physics space, false→not added
|
protected boolean |
enabled
true→control is enabled, false→control is disabled
|
protected PhysicsSpace |
space
space to which the vehicle is (or would be) added
|
protected Spatial |
spatial
spatial to which this control is added, or null if none
|
physicsSpace, rayCaster, tuning, vehicle, wheelsconstructionInfo, joints, kinematic, localInertia, mass, motionState, rBody, tempMatrix, tempTrans, tempVec, tempVec2COLLISION_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| Modifier | Constructor and Description |
|---|---|
protected |
VehicleControl()
No-argument constructor needed by SavableClassUtil.
|
|
VehicleControl(CollisionShape shape)
Instantiate an enabled control with mass=1 and the specified collision
shape.
|
|
VehicleControl(CollisionShape shape,
float mass)
Instantiate an enabled with the specified collision shape and mass.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cloneFields(Cloner cloner,
java.lang.Object original)
Callback from
Cloner to convert this
shallow-cloned control into a deep-cloned one, using the specified cloner
and original to resolve copied fields. |
Control |
cloneForSpatial(Spatial spatial)
Clone this control for a different spatial.
|
PhysicsSpace |
getPhysicsSpace()
Access the physics space to which the vehicle is (or would be) added.
|
boolean |
isApplyPhysicsLocal()
Test whether physics-space coordinates should match the spatial's local
coordinates.
|
boolean |
isEnabled()
Test whether this control is enabled.
|
java.lang.Object |
jmeClone()
Create a shallow clone for the JME cloner.
|
void |
read(JmeImporter im)
De-serialize this control, for example when loading from a J3O file.
|
void |
render(RenderManager rm,
ViewPort vp)
Render this control.
|
void |
setApplyPhysicsLocal(boolean applyPhysicsLocal)
Alter whether physics-space coordinates should match the spatial's local
coordinates.
|
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)
Alter which spatial is controlled.
|
void |
update(float tpf)
Update this control.
|
void |
write(JmeExporter ex)
Serialize this control, for example when saving to a J3O file.
|
accelerate, accelerate, addWheel, addWheel, applyWheelTransforms, brake, brake, createVehicle, destroy, getCurrentVehicleSpeedKmHour, getForwardVector, getFrictionSlip, getMaxSuspensionForce, getMaxSuspensionTravelCm, getNumWheels, getSuspensionCompression, getSuspensionDamping, getSuspensionStiffness, getVehicleId, getWheel, postRebuild, removeWheel, resetSuspension, setFrictionSlip, setFrictionSlip, setMaxSuspensionForce, setMaxSuspensionForce, setMaxSuspensionTravelCm, setMaxSuspensionTravelCm, setRollInfluence, setSuspensionCompression, setSuspensionCompression, setSuspensionDamping, setSuspensionDamping, setSuspensionStiffness, setSuspensionStiffness, steer, steer, updateWheelsactivate, addJoint, applyCentralForce, applyForce, applyImpulse, applyTorque, applyTorqueImpulse, clearForces, getAngularDamping, getAngularFactor, getAngularSleepingThreshold, getAngularVelocity, getAngularVelocity, getCcdMotionThreshold, getCcdSquareMotionThreshold, getCcdSweptSphereRadius, getFriction, getGravity, getGravity, getInterpolatedPhysicsLocation, getInterpolatedPhysicsRotation, getJoints, getLinearDamping, getLinearSleepingThreshold, getLinearVelocity, getLinearVelocity, getMass, getMotionState, getObjectId, getPhysicsLocation, getPhysicsLocation, getPhysicsRotation, getPhysicsRotation, getPhysicsRotationMatrix, getPhysicsRotationMatrix, getRestitution, isActive, isContactResponse, isKinematic, preRebuild, rebuildRigidBody, removeJoint, setAngularDamping, setAngularFactor, setAngularSleepingThreshold, setAngularVelocity, setCcdMotionThreshold, setCcdSweptSphereRadius, setCollisionShape, setContactResponse, setDamping, setFriction, setGravity, setKinematic, setLinearDamping, setLinearSleepingThreshold, setLinearVelocity, setMass, setPhysicsLocation, setPhysicsRotation, setPhysicsRotation, setRestitution, setSleepingThresholdsaddCollideWithGroup, getCollideWithGroups, getCollisionGroup, getCollisionShape, getUserObject, removeCollideWithGroup, setCollideWithGroups, setCollisionGroup, setUserObjectprotected Spatial spatial
protected boolean enabled
protected PhysicsSpace space
protected boolean added
protected VehicleControl()
public VehicleControl(CollisionShape shape)
shape - the desired shape (not null, alias created)public VehicleControl(CollisionShape shape, float mass)
shape - the desired shape (not null, alias created)mass - (>0)public boolean isApplyPhysicsLocal()
public void setApplyPhysicsLocal(boolean applyPhysicsLocal)
applyPhysicsLocal - true→match local coordinates,
false→match world coordinates (default=false)public Control cloneForSpatial(Spatial spatial)
cloneForSpatial in interface Controlspatial - the spatial for the clone to control (or null)public java.lang.Object jmeClone()
jmeClone in interface JmeCloneablepublic void cloneFields(Cloner cloner, java.lang.Object original)
Cloner to convert this
shallow-cloned control into a deep-cloned one, using the specified cloner
and original to resolve copied fields.cloneFields in interface JmeCloneablecloner - the cloner that's cloning this control (not null)original - the control from which this control was shallow-cloned
(unused)public void setSpatial(Spatial spatial)
setSpatial in interface Controlspatial - spatial to control (or null)public void setEnabled(boolean enabled)
When the control is disabled, the vehicle is removed from physics space. When the control is enabled again, the physics object is moved to the spatial's location and then added to the physics space.
setEnabled in interface PhysicsControlenabled - true→enable the control, false→disable itpublic boolean isEnabled()
isEnabled in interface PhysicsControlpublic void update(float tpf)
public void render(RenderManager rm, ViewPort vp)
public void setPhysicsSpace(PhysicsSpace newSpace)
setPhysicsSpace in interface PhysicsControlnewSpace - where to add, or null to simply removepublic PhysicsSpace getPhysicsSpace()
getPhysicsSpace in interface PhysicsControlpublic void write(JmeExporter ex) throws java.io.IOException
write in interface Savablewrite in class PhysicsVehicleex - exporter (not null)java.io.IOException - from exporterpublic void read(JmeImporter im) throws java.io.IOException
read in interface Savableread in class PhysicsVehicleim - importer (not null)java.io.IOException - from importer