public class VehicleController extends NativePhysicsObject
| Modifier and Type | Field and Description |
|---|---|
static java.util.logging.Logger |
logger
message logger for this class
|
loggerN| Constructor and Description |
|---|
VehicleController(PhysicsVehicle vehicle,
PhysicsSpace space)
Instantiate a controller for the specified collision object.
|
| Modifier and Type | Method and Description |
|---|---|
int |
addWheel(VehicleWheel wheel,
VehicleTuning tuning)
Add a wheel to this controller.
|
void |
applyEngineForce(VehicleWheel wheel,
float force)
Apply the specified engine force to the specified wheel.
|
void |
brake(VehicleWheel wheel,
float impulse)
Apply the specified brake impulse to the specified wheel.
|
float |
castRay(VehicleWheel wheel)
Determine the depth for the specified wheel by raycasting.
|
int |
countWheels()
Determine the number of wheels in this controller.
|
int |
forwardAxisIndex()
Determine the index of the vehicle's forward axis.
|
float |
getCurrentVehicleSpeedKmHour()
Determine the vehicle's speed in km/h.
|
Vector3f |
getForwardVector(Vector3f storeResult)
Determine the vehicle's forward direction.
|
void |
resetSuspension()
Reset the vehicle's suspension.
|
int |
rightAxisIndex()
Determine the index of the vehicle's right-side axis.
|
void |
setCoordinateSystem(int rightAxisIndex,
int upAxisIndex,
int forwardAxisIndex)
Alter the coordinate system of the vehicle.
|
void |
setCoordinateSystem(Vector3f right,
Vector3f up,
Vector3f forward)
Customize the coordinate system of the vehicle.
|
void |
steer(VehicleWheel wheel,
float angle)
Alter the steering angle of the specified wheel.
|
int |
upAxisIndex()
Determine the index of the vehicle's up axis.
|
void |
updateWheelTransform(VehicleWheel wheel)
Used internally.
|
compareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeId, setNativeIdNotTracked, toString, unassignNativeObjectpublic static final java.util.logging.Logger logger
public VehicleController(PhysicsVehicle vehicle, PhysicsSpace space)
vehicle - the collision object to control (not null)space - the PhysicsSpace where the collision object is or will be
added (not null)public int addWheel(VehicleWheel wheel, VehicleTuning tuning)
wheel - (not null, unaffected)tuning - (not null, unaffected)public void applyEngineForce(VehicleWheel wheel, float force)
wheel - which wheel (not null)force - the desired amount of force (may be negative)public void brake(VehicleWheel wheel, float impulse)
wheel - which wheel (not null)impulse - the desired impulsepublic float castRay(VehicleWheel wheel)
wheel - which wheel (not null, unaffected)public int countWheels()
public int forwardAxisIndex()
public float getCurrentVehicleSpeedKmHour()
public Vector3f getForwardVector(Vector3f storeResult)
storeResult - storage for the result (modified if not null)public void resetSuspension()
public int rightAxisIndex()
public void setCoordinateSystem(int rightAxisIndex,
int upAxisIndex,
int forwardAxisIndex)
rightAxisIndex - the desired local axis index (0→X, 1→Y,
2→Z, default=0)upAxisIndex - the desired local axis index (0→X, 1→Y,
2→Z, default=1)forwardAxisIndex - the desired local axis index (0→X, 1→Y,
2→Z, default=2)public void setCoordinateSystem(Vector3f right, Vector3f up, Vector3f forward)
right - the desired direction (in chassis coordinates, not null,
length=1, default=(1,0,0))up - the desired direction (in chassis coordinates, not null,
length=1, default=(0,1,0))forward - the desired direction (in chassis coordinates, not null,
length=1, default=(0,0,1))public void steer(VehicleWheel wheel, float angle)
wheel - which wheel to steer (not null)angle - the desired angle (in radians, 0=straight, positive=left)public int upAxisIndex()
public void updateWheelTransform(VehicleWheel wheel)
wheel - (not null)