Skyline Lua API  Version 1.0 RC1
Lua Script Reference for Skyline Game Engine.
LUA_API_Vehicle.h
Go to the documentation of this file.
1 // | _ ____ __ _
2 // | / \ _ _ _ __ __ _/ ___| ___ / _| |_
3 // | / _ \| | | | '__/ _` \___ \ / _ \| |_| __|
4 // | / ___ \ |_| | | | (_| |___) | (_) | _| |_
5 // | /_/ \_\__,_|_| \__,_|____/ \___/|_| \__|
6 // |
7 // | Aurasoft UK 2008 - 2016 http://www.aurasoft.co.uk
8 // |
9 // | Skyline Game Engine Lua API Documentation
10 // |
11 // | This file belongs to Aurasoft UK for the Skyline Game Engine of all versions.
12 // | This file is not for use in any other software that is not owned by Aurasoft UK and cannot be used by any other
13 // | person outside of the Skyline Game Engine development team.
14 // |
15 // | © Copyright - Aurasoft UK & Skyline Game Engine 2008 - 2016
16 // |
17 
18 // SKYLINE LUA CLASS FOR API DOCUMENTATION
19 
211 class vehicle
212 {
213 public:
214 
245  void createVehicle( string vehicleName, int sceneEntityID, float posX, float posY, float posZ, float rotW, float rotX, float rotY, float rotZ);
246 
258  void destroy( int vehicleID );
259 
272  int getVehicleID( int sceneEntityID, string vehicleName );
273  int getActiveVehicleID();
274 
275  void setAsPlayer( int vehicleID, int isPlayer [1 or 0] );
276  int isPlayer( int vehicleID );
277 
278  void setCurrentThrottle( int vehicleID, float throttle );
279  float getCurrentThrottle( int vehicleID );
280  void setCurrentGear( int vehicleID, int gear );
281  int getCurrentGear( int vehicleID ) ;
282  int getRPM( int vehicleID ) ;
283 
284  void setNumOfChassis( int vehicleID, int chassisNum );
285  void setNumberOfWheels( int vehicleID, int numWheels );
286  int getNumOfChassis( int vehicleID );
287  int getNumOfWheels( int vehicleID );
288  void createPhyicsBody( int vehicleID );
289  void addChassis( int vehicleID, int chassisIndex, float posXfloat posY, float posZ, float scaleX, float scaleY, float scaleZ );
290  void addWheel( int vehicleID, int vehicleID, int wheelIndex, int driveWheel, int steerWheel, float posX, float posY, float posZ);
291  void setWheelAsHandbrake( int vehicleID, int wheelIndex );
292  void createWheels( int vehicleID );
293  void setWheelMesh( int vehicleID, string wheelMeshName );
294  string getWheelMesh( int vehicleID );
295  void setWheelRadius( int vehicleID, int wheelIndex, float radius );
296  float getWheelRadius( int vehicleID, int wheelIndex );
297  float3 getWheelGlobalPosition( int vehicleID, int wheelIndex );
298  float3 getWheelLocalPosition( int vehicleID, int wheelIndex );
299  void setMaxSpeed_MPH( int vehicleID, int maxSpeedMPH );
300  void setMaxSpeed_KPH( int vehicleID, int maxSpeedKPH );
301  int getMaxSpeed_MPH( int vehicleID );
302  int getMaxSpeed_KPH( int vehicleID );
303  void setTorqueCurveSlot( int vehicleID, int rpm, int torque );
304  int getSpeed_Mph( int vehicleID );
305  int getSpeed_Kph( int vehicleID );
306  int getVelocity( int vehicleID );
307 
308  void setLinearVelocity( int vehicleID, float x, float y, float z );
309  void setAngularVelocity( int vehicleID, float x, float y, float z );
310  void setLinearMomentum( int vehicleID, float x, float y, float z );
311  void setAngularMomentum( int vehicleID, float x, float y, float z );
312  void setLinearDamping( int vehicleID, float damp );
313  void setAngularDamping( int vehicleID, float damp );
314 
315  void setInverseWheelMass( int vehicleID, int wheelIndex, float amt );
316  void useAirResistance( int vehicleID, int useResistance [0 or 1] );
317  void setAirResistance( int vehicleID, float baseValue, float multiplier );
318  void useAntiRoll( int vehicleID, int useAntiRoll [0 or 1] );
319  void setAntiRollAmount( int vehicleID, float antiRollAmt );
320 
321  void setMaxSteeringAngle( int vehicleID, float angle );
322  void setSteeringCoefMulti( int vehicleID, float coeff );
323  void setMotorTorque( int vehicleID, int wheelIndex, float torque );
324  void setBrakeTorque( int vehicleID, int wheelIndex, float torque );
325  void setPosition( int vehicleID, float posX, float posY, float posZ );
326  void setOrientation( int vehicleID, float rotW, float rotX, float rotY, float rotZ );
327 
328  void setNumberOfGears( int vehicleID, int numGears );
329  void setGearRatio( int vehicleID, float gearRatio );
330  void setRPM( int vehicleID, int minRpmToGearDown, int maxRpmToGearUp, int minRpm, int maxRpm );
331  void setMass( int vehicleID, float mass );
332  void setDownforce( int vehicleID, float downforce );
333  void setNoWheelsDownforce( int vehicleID, float downforce );
334  void setPairDownforce( int vehicleID, float downforce );
335 
336  void useWheelParticle( int vehicleID, int wheelIndex, int useParticle [0 or 1] );
337  void setWheelParticle( int vehicleID, int wheelIndex, string particleName );
338  void setWheelParticlePosition( int vehicleID, int wheelIndex, float x, float y, float z );
339  void setWheelParticleEnabled( int vehicleID, int wheelIndex, int isEnabled [0 or 1] );
340 
341  void setCenterOfMass( int vehicleID, float offsetX, float offsetY, float offsetZ );
342  void setLatWheelFrictionStiffness( int vehicleID, int wheelIndex, float stiffnessFactor );
343  void setLongWheelFrictionStiffness( int vehicleID, int wheelIndex, float stiffnessFactor );
344  void setLatWheelFrictionSettings( int vehicleID, int wheelIndex, float asymptoteSlip, float asymptoteValue, float extremumSlip, float extremumValue, float stiffnessFactor );
345  void setLongWheelFrictionSettings( int vehicleID, int wheelIndex, float asymptoteSlip, float asymptoteValue, float extremumSlip, float extremumValue, float stiffnessFactor );
346  void setSuspensionSettings( int vehicleID, int wheelIndex, float damperAmt, float springAmt, float targetValue, float suspensionTravel );
347 
348  void showDebug( int vehicleID, int showDebug[0 or 1] );
349  void setCustomDebugMaterial( int vehicleID, string customDebugMaterialName );
350 
351  void useSound( int vehicleID, int soundEnumSection, int useSound[0 or 1] );
352  void setSound( int vehicleID, int soundEnumSection, string soundFile );
353  void setVolume( int vehicleID, int soundEnumSection, float volume );
354  void setPitch( int vehicleID, int soundEnumSection, float pitch );
355  void setLength( int vehicleID, int soundEnumSection, float length );
356  void setLooped( int vehicleID, int soundEnumSection, int isLooped[0 or 1] );
357 
358  void accelerate( int vehicleID );
359  void decelerate( int vehicleID );
360 
370  void steerLeft( int vehicleID, int overrideSteering, float steeringAngle );
371 
381  void steerRight( int vehicleID, int overrideSteering, float steeringAngle);
382 
383  void handBrake( int vehicleID, float torque );
384 
385  void applyForce( int vehicleID, float axizX, float axizY, float axizZ );
386  void applyForceAtPoint( int vehicleID, float axizX, float axizY, float axizZ, float posX, float posY, float posZ );
387 
388  float getMaxBrakeForce( int vehicleID );
389 
397  int getMoveDirection( int vehicleID );
398 
415  void applyLocalForce( int vehicleID, float axizX, float axizY, float axizZ );
416 
436  void applyLocalForceAtPoint( int vehicleID, float axizX, float axizY, float axizZ, float posX, float posY, float posZ );
437 
452  int getWheel_ContactGround( int vehicleID, int wheelIndex );
453 
470  float3 getWheel_ContactPoint( int vehicleID, int wheelIndex );
471 
500  float getWheel_ContactPosition( int vehicleID, int wheelIndex );
501 
518  float3 getWheel_ContactNormal( int vehicleID, int wheelIndex );
519 
533  float getWheel_ContactForce( int vehicleID, int wheelIndex );
534 
548  float3 getWheel_LateralDirection( int vehicleID, int wheelIndex );
549 
563  float getWheel_LateralImpulse( int vehicleID, int wheelIndex );
564 
578  float getWheel_LateralSlip( int vehicleID, int wheelIndex );
579 
593  float3 getWheel_LongitudalDirection( int vehicleID, int wheelIndex );
594 
608  float getWheel_LongitudalImpulse( int vehicleID, int wheelIndex );
609 
623  float getWheel_LongitudalSlip( int vehicleID, int wheelIndex );
624 
637  void enableAutoMaxSteer(int vehicleID, int state);
638 
651  int getAutoMaxSteerEnabled(int vehicleID);
652 
665  void setSteeringMulti(int vehicleID, float multi);
666 
679  float getSteeringMulti(int vehicleID);
680 
681 
682 
701  void followPath(int vehicleID, string pathName, float throttle);
702 
716  int isFollowingPath(int vehicleID);
717 
731  string getFollowPathName(int vehicleID);
732 
748  void setPathAccuracy(int vehicleID, float accuracy);
749 
765  void setPathMaxTurn(int vehicleID, float maxTurn);
766 
781  void setPathNodeIndex(int vehicleID, int nodeIndex);
782 
814  void followPathPosition(int vehicleID, float x, float y, float z);
815 
831  int isDestinationReached(int vehicleID);
832 
841  vehicle.setTagOffset(vehID, wheelID, offset);
842 
851  vehicle.getTagOffset(vehID, wheelID);
852 
853 };
float getWheel_ContactPosition(int vehicleID, int wheelIndex)
Return the position of suspensionTravel between 0(not extended) and 1(fully extended).
void setPathAccuracy(int vehicleID, float accuracy)
Set the accuracy of the path to follow. Lower numbers make the distance to each node before trigger s...
void setAsPlayer(int vehicleID, int isPlayer[1 or 0])
void setWheelMesh(int vehicleID, string wheelMeshName)
void useAntiRoll(int vehicleID, int useAntiRoll[0 or 1])
void destroy(int vehicleID)
Destroy and cleanup a vehicle in the scene by the vehicle ID passed through this function You should ...
float getWheel_LongitudalImpulse(int vehicleID, int wheelIndex)
get the contact data of the specified wheel and retrieve the LongitudalImpulse value.
float3 getWheelGlobalPosition(int vehicleID, int wheelIndex)
void setLooped(int vehicleID, int soundEnumSection, int isLooped[0 or 1])
void setSteeringCoefMulti(int vehicleID, float coeff)
int getAutoMaxSteerEnabled(int vehicleID)
Gets whether the steering angle auto reduces based on speed.
void setTorqueCurveSlot(int vehicleID, int rpm, int torque)
void setNumberOfWheels(int vehicleID, int numWheels)
void followPathPosition(int vehicleID, float x, float y, float z)
Override the default path follow and enter your own point to move to. In order for this to take effec...
void setNoWheelsDownforce(int vehicleID, float downforce)
void createVehicle(string vehicleName, int sceneEntityID, float posX, float posY, float posZ, float rotW, float rotX, float rotY, float rotZ)
create a new scripted vehicle to work on. It will need setup with the correct functions.
void setNumOfChassis(int vehicleID, int chassisNum)
float getWheel_LateralImpulse(int vehicleID, int wheelIndex)
get the contact data of the specified wheel and retrieve the LateralImpulse value.
void setPathNodeIndex(int vehicleID, int nodeIndex)
Set the current node index the vehicle should head towards on the currently set path.
void useWheelParticle(int vehicleID, int wheelIndex, int useParticle[0 or 1])
void setMaxSpeed_KPH(int vehicleID, int maxSpeedKPH)
void setCustomDebugMaterial(int vehicleID, string customDebugMaterialName)
void setAngularDamping(int vehicleID, float damp)
void setDownforce(int vehicleID, float downforce)
int getNumOfChassis(int vehicleID)
int getMoveDirection(int vehicleID)
void setInverseWheelMass(int vehicleID, int wheelIndex, float amt)
float getWheel_LateralSlip(int vehicleID, int wheelIndex)
get the contact data of the specified wheel and retrieve the LateralSlip angle value.
void setLinearMomentum(int vehicleID, float x, float y, float z)
void setAntiRollAmount(int vehicleID, float antiRollAmt)
void setPitch(int vehicleID, int soundEnumSection, float pitch)
void applyLocalForceAtPoint(int vehicleID, float axizX, float axizY, float axizZ, float posX, float posY, float posZ)
Apply a local force at a particular point on the vehicle.
void steerRight(int vehicleID, int overrideSteering, float steeringAngle)
Calling this command will make the vehicle steer left either by the engine itself or a custom steer a...
float3 getWheelLocalPosition(int vehicleID, int wheelIndex)
void setMaxSpeed_MPH(int vehicleID, int maxSpeedMPH)
void setAngularMomentum(int vehicleID, float x, float y, float z)
int getVelocity(int vehicleID)
void steerLeft(int vehicleID, int overrideSteering, float steeringAngle)
Calling this command will make the vehicle steer left either by the engine itself or a custom steer a...
void setMaxSteeringAngle(int vehicleID, float angle)
float getWheel_ContactForce(int vehicleID, int wheelIndex)
Return the contact force data from the specified wheel.
void setAngularVelocity(int vehicleID, float x, float y, float z)
void addChassis(int vehicleID, int chassisIndex, float posXfloat posY, float posZ, float scaleX, float scaleY, float scaleZ)
void setVolume(int vehicleID, int soundEnumSection, float volume)
void setWheelParticlePosition(int vehicleID, int wheelIndex, float x, float y, float z)
void setLength(int vehicleID, int soundEnumSection, float length)
void applyForceAtPoint(int vehicleID, float axizX, float axizY, float axizZ, float posX, float posY, float posZ)
void setOrientation(int vehicleID, float rotW, float rotX, float rotY, float rotZ)
void setCurrentGear(int vehicleID, int gear)
void setMotorTorque(int vehicleID, int wheelIndex, float torque)
float getSteeringMulti(int vehicleID)
Set the multiplier between 1 and 0 to reduce the steering input. Useful for joysticks.
void addWheel(int vehicleID, int vehicleID, int wheelIndex, int driveWheel, int steerWheel, float posX, float posY, float posZ)
void setLinearVelocity(int vehicleID, float x, float y, float z)
string getFollowPathName(int vehicleID)
return the name of the path the vehicle is following
void applyLocalForce(int vehicleID, float axizX, float axizY, float axizZ)
Apply a local force to the center of the vehicle.
void setSound(int vehicleID, int soundEnumSection, string soundFile)
float3 getWheel_LongitudalDirection(int vehicleID, int wheelIndex)
get the contact data of the specified wheel and retrieve the LongitudalDirection
int isFollowingPath(int vehicleID)
return whether the vehicle is currently following a path.
void setNumberOfGears(int vehicleID, int numGears)
int getSpeed_Mph(int vehicleID)
void useSound(int vehicleID, int soundEnumSection, int useSound[0 or 1])
int getWheel_ContactGround(int vehicleID, int wheelIndex)
Get if the wheel specified is in contact with the ground and return a 1 or 0 boolean.
int isDestinationReached(int vehicleID)
Poll to check if the vehicle has reached its destination.
float3 getWheel_LateralDirection(int vehicleID, int wheelIndex)
get the contact data of the specified wheel and retrieve the LateralDirection
int getSpeed_Kph(int vehicleID)
Definition: LUA_API_States.h:28
void setGearRatio(int vehicleID, float gearRatio)
void setWheelRadius(int vehicleID, int wheelIndex, float radius)
float3 getWheel_ContactPoint(int vehicleID, int wheelIndex)
Get the point of contact with the floor and bottom of the wheel in world space.
void setAirResistance(int vehicleID, float baseValue, float multiplier)
int isPlayer(int vehicleID)
void setPathMaxTurn(int vehicleID, float maxTurn)
Set the maximum speed of the turning rate for this vehicle.
float getMaxBrakeForce(int vehicleID)
void setRPM(int vehicleID, int minRpmToGearDown, int maxRpmToGearUp, int minRpm, int maxRpm)
void setMass(int vehicleID, float mass)
void setPosition(int vehicleID, float posX, float posY, float posZ)
void useAirResistance(int vehicleID, int useResistance[0 or 1])
void enableAutoMaxSteer(int vehicleID, int state)
Sets the steering to auto adjust based on speed and reduce the steering angle.
void setWheelParticle(int vehicleID, int wheelIndex, string particleName)
void applyForce(int vehicleID, float axizX, float axizY, float axizZ)
void setPairDownforce(int vehicleID, float downforce)
void handBrake(int vehicleID, float torque)
vehicle getTagOffset(vehID, wheelID)
Get TAG offset.
void setWheelAsHandbrake(int vehicleID, int wheelIndex)
void accelerate(int vehicleID)
void setLinearDamping(int vehicleID, float damp)
string getWheelMesh(int vehicleID)
void setLatWheelFrictionStiffness(int vehicleID, int wheelIndex, float stiffnessFactor)
float getWheel_LongitudalSlip(int vehicleID, int wheelIndex)
get the contact data of the specified wheel and retrieve the LongitudalSlip angle value...
void setCurrentThrottle(int vehicleID, float throttle)
int getRPM(int vehicleID)
void setLongWheelFrictionStiffness(int vehicleID, int wheelIndex, float stiffnessFactor)
int getMaxSpeed_MPH(int vehicleID)
vehicle setTagOffset(vehID, wheelID, offset)
Set TAG offset.
int getNumOfWheels(int vehicleID)
void followPath(int vehicleID, string pathName, float throttle)
follow a path simply by calling this function in an update loop. The movement will automatically be s...
void decelerate(int vehicleID)
void showDebug(int vehicleID, int showDebug[0 or 1])
float getCurrentThrottle(int vehicleID)
int getVehicleID(int sceneEntityID, string vehicleName)
Get the ID of a vehicle by passing the scene entity ID and a vehicle Name.
void createPhyicsBody(int vehicleID)
void setLongWheelFrictionSettings(int vehicleID, int wheelIndex, float asymptoteSlip, float asymptoteValue, float extremumSlip, float extremumValue, float stiffnessFactor)
void setBrakeTorque(int vehicleID, int wheelIndex, float torque)
float3 getWheel_ContactNormal(int vehicleID, int wheelIndex)
Return the contact Normal from the specified wheel. This is the normal of the raycasted face...
void setCenterOfMass(int vehicleID, float offsetX, float offsetY, float offsetZ)
void setWheelParticleEnabled(int vehicleID, int wheelIndex, int isEnabled[0 or 1])
int getCurrentGear(int vehicleID)
int getMaxSpeed_KPH(int vehicleID)
int getActiveVehicleID()
void setSteeringMulti(int vehicleID, float multi)
Set the multiplier between 1 and 0 to reduce the steering input. Useful for joysticks.
void setLatWheelFrictionSettings(int vehicleID, int wheelIndex, float asymptoteSlip, float asymptoteValue, float extremumSlip, float extremumValue, float stiffnessFactor)
void setSuspensionSettings(int vehicleID, int wheelIndex, float damperAmt, float springAmt, float targetValue, float suspensionTravel)
Definition: LUA_API_Vehicle.h:211
float getWheelRadius(int vehicleID, int wheelIndex)
void createWheels(int vehicleID)