Methods defined here:
__init__(self, name)
Creates a physical vehicle having name 'name' without wheels. The chassis is a default object and is
changed by calling setChassis(...).
addAxis(self, type, meshName, zposition)
Will add an axis of type 'type' having mesh 'meshName'. The Mesh must be available
to the ogre resources.
addEnginePowerStep(self, ratio)
Adds a power step to the engine so that it will output value ratio*power at this step. The step position is set
with an internal call that increases and decreases with values set by calling setEngine(...).
This value must be 0 to 1 where 1 will be the maximum value set. There can be many steps taken for an engine to
reach 1. The first value should be 0 while the last is 1.
You can clear all steps by calling delEnginePowerSteps(...).
Raises VehicleError on failure.
addWheel(self, type, meshName)
Raises VehicleError on failure.
attach(self, body,
pos=[0, 0, 0], lforce=0, aforce=0)
Attaches the body to vehicles chassis position in local space where
- force is the strenght of the attachement. Force must be positive or 0 value
- pos is the position and
- body is the body instance
delEnginePowerSteps(self)
Clears engine steps added during call of addEnginePowerStep(...). Will revert to linear increase of power.
delWheel(self, type)
Removes the wheel from current vehicle setup. Raises VehicleError if the wheel does not exist.
Raises VehicleError if the wheel does not exist.
destroy(self)
Removes the vehicle and current attached parts to the vehicle such as wheel, engine, suspension, chassis, etc ...
getCorrection(self)
Gets this vehicles correct possition and rotation. This is used to update the network simulated
vehicles. Returns [[x, y ,z],[w, x, y, z]] formated string.
getDeadreconing(self)
getMaterial(self, part)
Returns the assinged material of the requested part. None if no material was defined for the part.
The successfull return value is material name
getName(self)
getOrientation(self)
Returns a quaternion of the vehicles orientation
getPartName(self, part)
Gets this vehicles generated name of the parts entity. The Parameter part must be one of
these supported strings: 'chassi' and 'tire'
getPosition(self)
Gets the vehicles position in global space.
getRotation(self)
Returns a array having [x,y,z] degree rotations
__MovableObjectProperty_Yaw = 4
__MovableObjectProperty_Roll = 5
__MovableObjectProperty_Pitch = 6
isDynamic(self)
makeDynamic(self)
Makes the actual vehicle according to the specified settings set through the set calls.
The representation is dynamic meaning it will be drivable and behave as an vehicle depending
on the settings.
makeStatic(self)
Makes the an static vehicle according to the specified settings set through the set calls.
The representation is static meaning it will NOT be drivable.
setAxisBolt(self, type, boltName, meshName,
offset=[0, 0, 0])
Creates and attaches an bolt to the axis. The axis 'type' is either 'FrontLeft', 'FrontRight', 'RearLeft' or 'RearRight' denoting the location of the axis.
The 'boltName' is used to connect another vehicle part to this bold.
The bolt is sort of a market that is used to identify the location.
'meshName' is the visual representation. The meshName must be an resource available mesh or null. If null no mesh
is used.
'offset' is a three dimensional location relative to the parent 'chassis' center (or in other words, parent space).
Raises VehicleError on failure
setBrake(self, axis, force=100)
Sets the vehicle brake force. May not be negative null value and axis is either 'Front' or 'Rear'
Raises VehicleError on failure.
setChassis(self,
mesh, mass, massoffset=[0,
-1, 0])
Sets the vehicles chassis to be mesh having mass and an massoffset.
Where mass must be a positive value. The mesh must exist in resources.
setChassisBolt(self, boltName, meshName,
offset=[0, 0, 0])
Creates and attaches an bolt to the chassis. The 'boltName' is used to connect another vehicle part to this bold.
The bolt is sort of a market that is used to identify the location.
'meshName' is the visual representation. The meshName must be an resource available mesh or null. If null no mesh
is used.
'offset' is a three dimensional location relative to the parent 'chassis' center (or in other words, parent space).
Raises VehicleError on failure
setControlArmBehavior(self, axisType, controlArmTravel)
Sets the control arm behavoir where
axisType is either 'FrontLeft', 'FrontRight', 'RearLeft', 'RearRight' and
controlArmTravel is larger than zero.
Raises VehicleError on failure
setControlArmMotion(self, axisType, boltType, meshName, pivotOffset=[0, 0, 0],
behavior='Connect')
Creates an visual representation of the control arm (can be omitted). Where
axisType is either 'FrontLeft', 'FrontRight', 'RearLeft', 'RearRight'
boltType is created through calls setChassisBolt and setAxisBolt
meshName if name of file that is accessable by ogre resource system.
pivotSystem has three float values positioning the pivot of the vehicle part (where pivot is the axis which we rotate around)
behavoir is either 'Connect' ... TBD
If this call is not called then no visual representation will be created for this vehicle part but it will
function properly.
Raises VehicleError on failure
setCorrection(self, posrot)
Corrects the vehicle position and orientation if needed where posrot is a string having
format [[x, y ,z],[w, x, y, z]]. This string is turned into
two arrays. First having 3 values (x,y,z) and the second having quaternion (w,x,y,z).
Returns true if correction was made false if no correction was needed.
setDeadreconing(self, data)
setDriveShaftMotion(self, axisType, boltType, meshName, pivotOffset=[0, 0, 0],
behavior='Connect')
Creates an visual representation of the drive shaft (can be omitted). Where
axisType is either 'FrontLeft', 'FrontRight', 'RearLeft', 'RearRight'
boltType is created through calls setChassisBolt and setAxisBolt
meshName if name of file that is accessable by ogre resource system.
pivotSystem has three float values positioning the pivot of the vehicle part (where pivot is the axis which we rotate around)
behavoir is either 'Connect' ... TBD
If this call is not called then no visual representation will be created for this vehicle part but it will
function properly.
Raises VehicleError on failure
setEngine(self, power, increase, decrease)
Sets the vehicles engine properties where power is the maximum power through output and increase / decrease is the speed in with the
engine increase and decrease its output. These are values must be larger than 0 (good values are 60, 0.8, 1). They decide how fast the engine
will go from 0% to 100% during gas intake and gas halt. Where at 100% it will give defined power.
Call addPowerStep to tune how much the engine will output at these steps.
Raises VehicleError on failure.
setMaterial(self, part, material)
Sets this vehicles generated entities to te specified material 'material' of the vehicle.
The parameter 'part' must be one of these supported strings: see getPartName.
Raises VehicleError on failure. Stores the material on success and can be reassigned through call useMaterial()
setOrientation(self, w, x, y, z)
Sets the vehicles orientation of type quaternion in global space.
setPosition(self, x, y, z)
Sets the vehicles position in global space. The y position will be calculated "ground height + y". If y is None we use the ground height for y.
setShockAbsorberBehavior(self, axisType, shockAbsorberDamper, shockAbsorberTarget)
Sets the control arm behavoir where
axisType is either 'FrontLeft', 'FrontRight', 'RearLeft', 'RearRight' and
shockAbsorberDamper is larger than zero and
shockAbsorberTarget is between zero and one.
Raises VehicleError on failure
setShockAbsorberMotion(self, axisType, boltType, meshName, pivotOffset=[0, 0, 0],
behavior='Connect')
Creates an visual representation of the shock absorber (can be omitted). Where
axisType is either 'FrontLeft', 'FrontRight', 'RearLeft', 'RearRight'
boltType is created through calls setChassisBolt and setAxisBolt
meshName if name of file that is accessable by ogre resource system.
pivotSystem has three float values positioning the pivot of the vehicle part (where pivot is the axis which we rotate around)
behavoir is either 'Connect' ... TBD
If this call is not called then no visual representation will be created for this vehicle part but it will
function properly.
Raises VehicleError on failure
setSteer(self, SteerServoIncrease=4, SteerServoDecrease=4, SteerMax=0.59999999999999998, RotateOwnAxisOnStop=0)
Sets the servo steering of the wheels. Where SteerServoIncrease is the speed in which we turn the wheel and SteerServoDecrease is the
speed the wheels restores themselfs when player stops steering. SteerMax is the maximum angle (in radians) that we may steer at either direction.
The speed in which we turn must be not null positive values and SteerMax maximum value is 1.4 (80 degrees).
Raises VehicleError on failure.
setSuspensionBehavior(self, axisType, suspensionSpring)
Sets the control arm behavoir where
axisType is either 'Front' or 'Rear' and
suspensionSpring is larger than zero.
Raises VehicleError on failure
setSuspensionMotion(self, axisType, boltType, meshName, pivotOffset=[0, 0, 0],
behavior='Connect')
Creates an visual representation of the suspenion (can be omitted). Where
axisType is either 'FrontLeft', 'FrontRight', 'RearLeft', 'RearRight'
boltType is created through calls setChassisBolt and setAxisBolt
meshName if name of file that is accessable by ogre resource system.
pivotSystem has three float values positioning the pivot of the vehicle part (where pivot is the axis which we rotate around)
behavoir is either 'Connect' ... TBD
If this call is not called then no visual representation will be created for this vehicle part but it will
function properly.
Raises VehicleError on failure
setTireBehavior(self, axis, LateralAsymptoteSlip,
LateralAsymptoteValue, LateralExtremumSlip,
LateralExtremumValue, LongitudalAsymptoteSlip,
LongitudalAsymptoteValue, LongitudalExtremumSlip,
LongitudalExtremumValue)
The behavior of the tire is dependent on these values. They are used to calculate the grip with relation to force and wheel rotation.
See PhysX documentation on NxWheelShape for detailed information.
'axis' is either 'Front' or 'Rear'.
LateralAsymptoteSlip, LateralAsymptoteValue, LateralExtremumSlip, LateralExtremumValue.
LongitudalAsymptoteSlip, LongitudalAsymptoteValue, LongitudalExtremumSlip, LongitudalExtremumValue.
Must be positive values, LateralExtremumSlip < LateralAsymptoteSlip and LongitudalExtremumSlip < LongitudalAsymptoteSlip
Raises VehicleError on failure.
setTireGrip(self, axis, longitudal, lateral)
Sets the vehicle tires grip on 'axis' where axis is either 'Front' or 'Rear'.
The grip is the stiffness factor dependent on force.
Must have positive values. Raises VehicleError on failure.
setWheelBehavior(self, axisType, mass, massinv)
Sets the wheel behavior through mass and mass inverted values. Where
axisType is either 'FrontLeft', 'FrontRight', 'RearLeft', 'RearRight' and
mass and massinv is not negative values.
setWheelParticles(self, particleMaterial='', channel=0,
delta=0)
Sets the vehicles wheel particle material. The material must be loaded or loadable by Ogre.
The material will be set to the wheel imidiatly and used when driving depending on settings provided.
Where particleMaterial is the name of an existing accessable ogre material
and channel is the channel to be assigned the particles (channels are integer values from 0 to 3)
and delta is the delta value to be added where we start our emission from (for instance if rotation
power is .3 and this is .5 then output will be .8)
If particleMaterial is NULL ('') then the particles for channel 'channel' is removed.
Raises VehicleError on failure.
setWheelTracks(self, materialName)
Sets vehicles wheel track material. The material named 'materialName' must be loaded by Ogre.
The material named 'materialName' will imidiatly be used on current tracks.
If null then wheel tracks are disabled.
useMaterial(self)
Will use the previus assigned material on all the objects. This is mainly so we do not need to
get the information again (we just reuse it).
Raises VehicleError if dictionary was not set at all (no succesfull call to setMaterial was made)
Data and other attributes
defined here:
file = None
name = None
types = {'FrontLeft': [0,
False], 'FrontRight': [0, True], 'RearLeft': [1, False], 'RearRight':
[1, True]}
|