Package com.jme3.bullet.control
Class VehicleControl
java.lang.Object
com.jme3.bullet.collision.PhysicsCollisionObject
com.jme3.bullet.objects.PhysicsRigidBody
com.jme3.bullet.objects.PhysicsVehicle
com.jme3.bullet.control.VehicleControl
- All Implemented Interfaces:
- PhysicsControl,- Savable,- Control,- JmeCloneable,- Cloneable
A physics control to link a PhysicsVehicle to a spatial.
 
This class is shared between JBullet and Native Bullet.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected booleantrue→vehicle is added to the physics space, false→not addedprotected booleantrue→control is enabled, false→control is disabledprotected PhysicsSpacespace to which the vehicle is (or would be) addedprotected Spatialspatial to which this control is added, or null if noneFields inherited from class com.jme3.bullet.objects.PhysicsVehiclephysicsSpace, rayCaster, tuning, vehicle, wheelsFields inherited from class com.jme3.bullet.objects.PhysicsRigidBodyconstructionInfo, joints, kinematic, localInertia, mass, motionState, rBody, tempMatrix, tempTrans, tempVec, tempVec2Fields 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 SummaryConstructorsModifierConstructorDescriptionprotectedNo-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.
- 
Method SummaryModifier and TypeMethodDescriptionvoidcloneFields(Cloner cloner, Object original) Callback fromClonerto convert this shallow-cloned control into a deep-cloned one, using the specified cloner and original to resolve copied fields.cloneForSpatial(Spatial spatial) Clone this control for a different spatial.Access the physics space to which the vehicle is (or would be) added.booleanTest whether physics-space coordinates should match the spatial's local coordinates.booleanTest whether this control is enabled.jmeClone()Create a shallow clone for the JME cloner.voidread(JmeImporter im) De-serialize this control, for example when loading from a J3O file.voidrender(RenderManager rm, ViewPort vp) Render this control.voidsetApplyPhysicsLocal(boolean applyPhysicsLocal) Alter whether physics-space coordinates should match the spatial's local coordinates.voidsetEnabled(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) Alter which spatial is controlled.voidupdate(float tpf) Update this control.voidwrite(JmeExporter ex) Serialize this control, for example when saving to a J3O file.Methods inherited from class com.jme3.bullet.objects.PhysicsVehicleaccelerate, 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, updateWheelsMethods inherited from class com.jme3.bullet.objects.PhysicsRigidBodyactivate, 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, setSleepingThresholdsMethods inherited from class com.jme3.bullet.collision.PhysicsCollisionObjectaddCollideWithGroup, getCollideWithGroups, getCollisionGroup, getCollisionShape, getUserObject, removeCollideWithGroup, setCollideWithGroups, setCollisionGroup, setUserObject
- 
Field Details- 
spatialspatial to which this control is added, or null if none
- 
enabledprotected boolean enabledtrue→control is enabled, false→control is disabled
- 
spacespace to which the vehicle is (or would be) added
- 
addedprotected boolean addedtrue→vehicle is added to the physics space, false→not added
 
- 
- 
Constructor Details- 
VehicleControlprotected VehicleControl()No-argument constructor needed by SavableClassUtil. Do not invoke directly!
- 
VehicleControlInstantiate an enabled control with mass=1 and the specified collision shape.- Parameters:
- shape- the desired shape (not null, alias created)
 
- 
VehicleControlInstantiate an enabled with the specified collision shape and mass.- Parameters:
- shape- the desired shape (not null, alias created)
- mass- (>0)
 
 
- 
- 
Method Details- 
isApplyPhysicsLocalpublic boolean isApplyPhysicsLocal()Test whether physics-space coordinates should match the spatial's local coordinates.- Returns:
- true if matching local coordinates, false if matching world coordinates
 
- 
setApplyPhysicsLocalpublic void setApplyPhysicsLocal(boolean applyPhysicsLocal) Alter whether physics-space coordinates should match the spatial's local coordinates.- Parameters:
- applyPhysicsLocal- true→match local coordinates, false→match world coordinates (default=false)
 
- 
cloneForSpatialClone this control for a different spatial. No longer used as of JME 3.1.- Specified by:
- cloneForSpatialin interface- Control
- Parameters:
- spatial- the spatial for the clone to control (or null)
- Returns:
- a new control (not null)
 
- 
jmeCloneCreate a shallow clone for the JME cloner.- Specified by:
- jmeClonein interface- JmeCloneable
- Returns:
- a new control (not null)
 
- 
cloneFieldsCallback fromClonerto convert this shallow-cloned control into a deep-cloned one, using the specified cloner and original to resolve copied fields.- Specified by:
- cloneFieldsin interface- JmeCloneable
- Parameters:
- cloner- the cloner that's cloning this control (not null)
- original- the control from which this control was shallow-cloned (unused)
 
- 
setSpatialAlter which spatial is controlled.- Specified by:
- setSpatialin interface- Control
- Parameters:
- spatial- spatial to control (or null)
 
- 
setEnabledpublic void setEnabled(boolean enabled) Enable or disable this control.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. - Specified by:
- setEnabledin interface- PhysicsControl
- Parameters:
- enabled- true→enable the control, false→disable it
 
- 
isEnabledpublic boolean isEnabled()Test whether this control is enabled.- Specified by:
- isEnabledin interface- PhysicsControl
- Returns:
- true if enabled, otherwise false
 
- 
updatepublic void update(float tpf) Update this control. Invoked once per frame, during the logical-state update, provided the control is added to a scene.
- 
renderRender this control. Invoked once per view port per frame, provided the control is added to a scene. Should be invoked only by a subclass or by the RenderManager.
- 
setPhysicsSpaceIf enabled, add this control's physics object to the specified physics space. In 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
 
- 
getPhysicsSpaceAccess the physics space to which the vehicle is (or would be) added.- Specified by:
- getPhysicsSpacein interface- PhysicsControl
- Returns:
- the pre-existing space, or null for none
 
- 
writeSerialize this control, for example when saving to a J3O file.- Specified by:
- writein interface- Savable
- Overrides:
- writein class- PhysicsVehicle
- Parameters:
- ex- exporter (not null)
- Throws:
- IOException- from exporter
 
- 
readDe-serialize this control, for example when loading from a J3O file.- Specified by:
- readin interface- Savable
- Overrides:
- readin class- PhysicsVehicle
- Parameters:
- im- importer (not null)
- Throws:
- IOException- from importer
 
 
-