com.bulletphysics.dynamics.vehicle
Class RaycastVehicle
java.lang.Object
com.bulletphysics.dynamics.constraintsolver.TypedConstraint
com.bulletphysics.dynamics.vehicle.RaycastVehicle
public class RaycastVehicle
- extends TypedConstraint
Raycast vehicle, very special constraint that turn a rigidbody into a vehicle.
Method Summary |
WheelInfo |
addWheel(Vector3f connectionPointCS,
Vector3f wheelDirectionCS0,
Vector3f wheelAxleCS,
float suspensionRestLength,
float wheelRadius,
VehicleTuning tuning,
boolean isFrontWheel)
Basically most of the code is general for 2 or 4 wheel vehicles, but some of it needs to be reviewed. |
void |
applyEngineForce(float force,
int wheel)
|
void |
buildJacobian()
|
float |
getCurrentSpeedKmHour()
Velocity of vehicle (positive if velocity vector has same direction as foward vector). |
int |
getForwardAxis()
|
Vector3f |
getForwardVector(Vector3f out)
Worldspace forward vector. |
Transform |
getChassisWorldTransform(Transform out)
|
int |
getNumWheels()
|
int |
getRightAxis()
|
RigidBody |
getRigidBody()
|
float |
getSteeringValue(int wheel)
|
int |
getUpAxis()
|
WheelInfo |
getWheelInfo(int index)
|
Transform |
getWheelTransformWS(int wheelIndex,
Transform out)
|
float |
rayCast(WheelInfo wheel)
|
void |
resetSuspension()
|
void |
setBrake(float brake,
int wheelIndex)
|
void |
setCoordinateSystem(int rightIndex,
int upIndex,
int forwardIndex)
|
void |
setPitchControl(float pitch)
|
void |
setSteeringValue(float steering,
int wheel)
|
void |
solveConstraint(float timeStep)
|
void |
updateFriction(float timeStep)
|
void |
updateSuspension(float deltaTime)
|
void |
updateVehicle(float step)
|
void |
updateWheelTransform(int wheelIndex)
|
void |
updateWheelTransform(int wheelIndex,
boolean interpolatedTransform)
|
void |
updateWheelTransformsWS(WheelInfo wheel)
|
void |
updateWheelTransformsWS(WheelInfo wheel,
boolean interpolatedTransform)
|
wheelInfo
public ObjectArrayList<WheelInfo> wheelInfo
RaycastVehicle
public RaycastVehicle(VehicleTuning tuning,
RigidBody chassis,
VehicleRaycaster raycaster)
addWheel
public WheelInfo addWheel(Vector3f connectionPointCS,
Vector3f wheelDirectionCS0,
Vector3f wheelAxleCS,
float suspensionRestLength,
float wheelRadius,
VehicleTuning tuning,
boolean isFrontWheel)
- Basically most of the code is general for 2 or 4 wheel vehicles, but some of it needs to be reviewed.
getWheelTransformWS
public Transform getWheelTransformWS(int wheelIndex,
Transform out)
updateWheelTransform
public void updateWheelTransform(int wheelIndex)
updateWheelTransform
public void updateWheelTransform(int wheelIndex,
boolean interpolatedTransform)
resetSuspension
public void resetSuspension()
updateWheelTransformsWS
public void updateWheelTransformsWS(WheelInfo wheel)
updateWheelTransformsWS
public void updateWheelTransformsWS(WheelInfo wheel,
boolean interpolatedTransform)
rayCast
public float rayCast(WheelInfo wheel)
getChassisWorldTransform
public Transform getChassisWorldTransform(Transform out)
updateVehicle
public void updateVehicle(float step)
setSteeringValue
public void setSteeringValue(float steering,
int wheel)
getSteeringValue
public float getSteeringValue(int wheel)
applyEngineForce
public void applyEngineForce(float force,
int wheel)
getWheelInfo
public WheelInfo getWheelInfo(int index)
setBrake
public void setBrake(float brake,
int wheelIndex)
updateSuspension
public void updateSuspension(float deltaTime)
updateFriction
public void updateFriction(float timeStep)
buildJacobian
public void buildJacobian()
- Specified by:
buildJacobian
in class TypedConstraint
solveConstraint
public void solveConstraint(float timeStep)
- Specified by:
solveConstraint
in class TypedConstraint
getNumWheels
public int getNumWheels()
setPitchControl
public void setPitchControl(float pitch)
getRigidBody
public RigidBody getRigidBody()
getRightAxis
public int getRightAxis()
getUpAxis
public int getUpAxis()
getForwardAxis
public int getForwardAxis()
getForwardVector
public Vector3f getForwardVector(Vector3f out)
- Worldspace forward vector.
getCurrentSpeedKmHour
public float getCurrentSpeedKmHour()
- Velocity of vehicle (positive if velocity vector has same direction as foward vector).
setCoordinateSystem
public void setCoordinateSystem(int rightIndex,
int upIndex,
int forwardIndex)