Skyline Lua API  Version 1.0
Lua Script Reference for Skyline Game Engine.
LUA_API_Physics.h
Go to the documentation of this file.
1 // | _ ____ __ _
2 // | / \ _ _ _ __ __ _/ ___| ___ / _| |_
3 // | / _ \| | | | '__/ _` \___ \ / _ \| |_| __|
4 // | / ___ \ |_| | | | (_| |___) | (_) | _| |_
5 // | /_/ \_\__,_|_| \__,_|____/ \___/|_| \__|
6 // |
7 // | Aurasoft UK 2008 - 2018 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 - 2018
16 // |
17 
18 // SKYLINE LUA CLASS FOR API DOCUMENTATION
19 
28 class Physics
29 {
30 public:
31 
40  void pause();
41 
50  void resume();
51 
95  int addBody(int entityID, enum body_Type, int dynamic, int mass);
96 
121  int addTrigger(int entityID, int eventFlag );
122 
145  void setCollisionFlag( int bodyID, int eventFlag );
146 
147 
174  int addPlayerBody(int objID, float radius, float height, float heightOffset, int dynamic);
175 
185  void removeBody(int objID, int bodyID);
186 
204  int getBodyID(int objID);
205 
226  void setActive(int bodyID,int state);
227 
246  void setSkinWidth(int bodyID, float width);
247 
265  void setMass(int bodyID,float mass);
266 
282  float getMass(int bodyID);
283 
284 
304  void setBounce(int bodyID,float bounce);
305 
321  float getBounce(int bodyID);
322 
343  void setFriction(int bodyID,float friction);
344 
360  float getFriction(int bodyID);
361 
362 
380  void setTerrainBounce(float bounce);
381 
382 
399  void setTerrainFriction(float friction);
400 
421  void setAngularVelocity(int bodyID, float x, float y, float z);
422 
434  float3 getAngularVelocity( int bodyID );
435 
451  void setMaxAngularVelocity(int bodyID,x,y,z);
452 
476  void setVelocity(int bodyID,x,y,z);
477 
495  void getVelocity(int bodyID);
496 
512  float getVelocityMagnitude( int bodyID );
513 
528  void setLinearDamping(int bodyID, float linearDamping);
529 
541  float getLinearDamping(int bodyID);
542  void setAngularDamping(int bodyID, float angularDamping);
558 
570  float getAngularDamping(int bodyID);
571 
594  void setImpulse(int bodyID,x,y,z);
595 
624  void setImpulseAtPoint(int bodyID, float posX, float posY, float posZ, float impulseX, float impulseY, float impulseZ);
625 
650  void setLocalImpulse(int bodyID, float impulseX, float impulseY, float impulseZ);
651 
680  void setLocalImpulseAtPoint(int bodyID, float posX, float posY, float posZ, float impulseX, float impulseY, float impulseZ);
681 
704  void setForce(int bodyID,x,y,z);
705 
733  void setForceAtPoint(int bodyID, float posX, float posY, float posZ, float forceX, float forceY, float forceZ);
734 
758  void setLocalForce(int bodyID, float forceX, float forceY, float forceZ);
759 
786  void setLocalForceAtPoint(int bodyID, float posX, float posY, float posZ, float forceX, float forceY, float forceZ);
787 
802  void setGravity(x,y,z);
803 
823  void setRotation(int bodyID, float w,float x,float y,float z);
824 
840  float4 getRotation(int bodyID);
841 
860  void setPosition(int bodyID, float x, float y, float z);
861 
882  float3 getPosition(int bodyID);
883 
908  void setBodyGravity(int bodyID,float x,float y,float z);
909 
921  float3 getGravity();
922 
923 
924 
925 
938  int createRay();
939 
964  float4 rayFromPoint(int rayID, float x, float y, float z, float qw, float qx, float qy, float qz, float range);
965 
999  float4 rayFromPointByAxis(int rayID, float x, float y, float z, float rx, float ry, float rz, float range);
1000 
1020  void rayDebugLines(int rayID, int state);
1021 
1033  void deleteRay(int rayID);
1034 
1059  void rayGetDistance(int rayID);
1060 
1089  void rayGetNormal(int rayID);
1090 
1118  void rayGetImpactPos(int rayID);
1119 
1135  void setCollisionEnable_OnStart(int bodyID);
1136 
1152  void setCollisionEnable_OnStay(int bodyID);
1153 
1169  void setCollisionEnable_OnEnd(int bodyID);
1170 
1171 
1191  void setTriggerPosition(int bodyID, float x, float y, float z);
1192 
1212  void setTriggerOrientation(int bodyID, float w, float x, float y, float z);
1213 
1214 
1225  String getGameType(int objID);
1226 
1240  void setGameType(int objID,String gameType);
1241 
1258  void setGroupCollisionFlag(int groupFlag_1, int groupFlag_2, bool state);
1259 
1260 
1280  void assignGroupCollisionFlag(int bodyID, int groupFlag);
1281 
1301  void setSceneGravity( float x, float y, float z );
1302 
1303 
1319  void move(int bodyID, float x, float y, float z);
1320 
1337  void rotate(int bodyID, float x, float y, float z, float w);
1338 
1339 
1351  void getContactData();
1352 
1366  void getContactNumShapes();
1367 
1381  float3 getContactPoint(int shapeid);
1382 
1397  float getContactForce(int shapeid);
1398 
1410  float3 getContactNormal();
1411 
1422  int getContactEntID();
1423 
1424 
1436  float4 rayFromIDToID(int rayID, int sourceID, int targetID, float range, int optionalQueryFlag);
1437 
1449  int addBody(int objID, enum body_Type, int isDynamic, int mass, int isKinematic);
1450 
1462  float3 getStaticOffset(int bodyID);
1463 
1464 
1465 
1466 
1467 };
String getGameType(int objID)
Gets the collision type from the physics object with a previously defined game type.Use this to quickly check for a specific type of objects when colliding.
void setForce(int bodyID, x, y, z)
Use this function to apply a vector Force to an existing rigid body.
void setLocalImpulse(int bodyID, float impulseX, float impulseY, float impulseZ)
Use this function to apply a local impulse to a physics body.
void setLocalImpulseAtPoint(int bodyID, float posX, float posY, float posZ, float impulseX, float impulseY, float impulseZ)
Use this function to apply a local impulse to a physics body from a local position.
float getFriction(int bodyID)
Use this function to return the friction of an existing rigid body.
void setVelocity(int bodyID, x, y, z)
Use this function to apply a vector velocity to an existing rigid body.
float4 rayFromIDToID(int rayID, int sourceID, int targetID, float range, int optionalQueryFlag)
Ray from ID to ID Fire a ranged ray between to objects source id and target id. Flags are so that you...
float3 getContactNormal()
Get contact normal.
int addTrigger(int entityID, int eventFlag)
Use this function to add a Trigger volume to the defined entity.
void setCollisionFlag(int bodyID, int eventFlag)
Use this function to add any of the collision Event data to a scipt. Mainly used for microscripts to ...
int createRay()
Creates a unique ray ready for ray casting.
float getContactForce(int shapeid)
Get the force of the contact.
int addBody(int entityID, enum body_Type, int dynamic, int mass)
Use this function to add a rigid body to the entity defined.
void setTriggerPosition(int bodyID, float x, float y, float z)
Sets position of a spawned trigger using a float3.
void setMass(int bodyID, float mass)
Use this function to set the mass of an existing rigid body.
void setLocalForceAtPoint(int bodyID, float posX, float posY, float posZ, float forceX, float forceY, float forceZ)
Use this function to apply a local force to a physics body from a local position. ...
void setPosition(int bodyID, float x, float y, float z)
Sets the position of the physic body.
void setImpulse(int bodyID, x, y, z)
Use this function to apply a vector Impulse to an existing rigid body.
int getBodyID(int objID)
Use this function to return the rigid body ID of an existing rigid body.
void setAngularVelocity(int bodyID, float x, float y, float z)
Use this function to apply an angular velocity to the physics body.
void deleteRay(int rayID)
Deletes the ray with the id rayID.
void setForceAtPoint(int bodyID, float posX, float posY, float posZ, float forceX, float forceY, float forceZ)
Use this function to apply a vector Force to an existing rigid body from a position in world space...
void assignGroupCollisionFlag(int bodyID, int groupFlag)
Define which groups this object belongs to.
void setBounce(int bodyID, float bounce)
Use this function to set the bounce amount of an existing rigid body.
float getMass(int bodyID)
Use this function to return the mass of an existing rigid body.
void setMaxAngularVelocity(int bodyID, x, y, z)
Use this function to increase the maximum allowed rotational velocity.
void setCollisionEnable_OnEnd(int bodyID)
Sets the contact report flag for collision end, ie as the object leaves the collision area...
void getContactNumShapes()
Get contact Shape Number.
float4 rayFromPointByAxis(int rayID, float x, float y, float z, float rx, float ry, float rz, float range)
Creates a unique ray ready for ray casting using physics.
void setGravity(x, y, z)
Sets the global gravity of the physic simulation.
float3 getContactPoint(int shapeid)
Get the Contact Point.
int addPlayerBody(int objID, float radius, float height, float heightOffset, int dynamic)
Use this function to add a rigid body Player Capsule to the entity defined.
float getAngularDamping(int bodyID)
Gets the angular damping coefficient from a physics body.
void pause()
Pauses the Physics system from updating meaning all physics object will stop moving, but also wont be collidable. No Arguments required.
void rayGetImpactPos(int rayID)
Pass in the rayID from a raycast that has been used to get the impact position of the ray...
void setLinearDamping(int bodyID, float linearDamping)
Sets the linear damping coefficient of a physics body.
void setTerrainFriction(float friction)
Use this function to set the friction amount of a terrain rigid body.
float3 getPosition(int bodyID)
Gets the position of the physics body.
Definition: LUA_API_Physics.h:28
float3 getAngularVelocity(int bodyID)
Use this function to get the angular velocity of the physics body in a float3.
void setGroupCollisionFlag(int groupFlag_1, int groupFlag_2, bool state)
Enables the collision between two groups passed in the groupFlag arg.
void setActive(int bodyID, int state)
Use this function to enable/disable an existing rigid body.
void setFriction(int bodyID, float friction)
Use this function to set the friction amount of an existing rigid body.
void getContactData()
Contafct Data.
Definition: LUA_API_States.h:28
void setImpulseAtPoint(int bodyID, float posX, float posY, float posZ, float impulseX, float impulseY, float impulseZ)
Use this function to apply a vector Impulse to an existing rigid body from a position in world space...
float3 getGravity()
Get the global gravity of the current physics simulation.
float getBounce(int bodyID)
Use this function to return the bounce of an existing rigid body.
void setCollisionEnable_OnStay(int bodyID)
Sets the contact report flag for collision stay, ie while the objects intersect.
void setCollisionEnable_OnStart(int bodyID)
Sets the contact report flag for collision start ie the first collision contact.
void setTerrainBounce(float bounce)
Use this function to set the bounce amount of a terrain rigid body.
void resume()
Resumes the physics which allows the update routines to work again as normal. No Arguments required...
void setSkinWidth(int bodyID, float width)
Set the skin width of the physics object.
float4 getRotation(int bodyID)
Gets the rotation as a quaternion of the physics body specified.
void setGameType(int objID, String gameType)
Sets the collision type for the physics object. Use this to quickly check for a specific type of obje...
void removeBody(int objID, int bodyID)
REmoves an existing ridgid body.
void rayDebugLines(int rayID, int state)
Creates a unique ray ready for ray casting.
void setRotation(int bodyID, float w, float x, float y, float z)
Sets the rotation of the physic body.
void setBodyGravity(int bodyID, float x, float y, float z)
**DEPRECIATED BULLET ** Sets the gravity of the specified rigidbody.
void rayGetDistance(int rayID)
Pass in the rayID from a raycast that has been used to get the distance of the ray. This distance is between the point of the ray start to the impacting position.
void getVelocity(int bodyID)
Use this function get the velocity of an existing rigid body.
int getContactEntID()
Get the ID of the object that made contact.
float3 getStaticOffset(int bodyID)
Get Static Offset the offset of the bodies position on the object.
void setAngularDamping(int bodyID, float angularDamping)
Sets the angular damping coefficient of a physics body.
float getLinearDamping(int bodyID)
Gets the linear damping coefficient from a physics body.
float4 rayFromPoint(int rayID, float x, float y, float z, float qw, float qx, float qy, float qz, float range)
Creates a unique ray ready for ray casting.
void setSceneGravity(float x, float y, float z)
Set the gravity of the physics scene.
void setLocalForce(int bodyID, float forceX, float forceY, float forceZ)
Use this function to apply a local force to a physics body.
void rayGetNormal(int rayID)
Pass in the rayID from a raycast that has been used to get the normal of the surface the ray has inte...
void rotate(int bodyID, float x, float y, float z, float w)
Rotates a kinematic Rigidbody to a set orientation.
void setTriggerOrientation(int bodyID, float w, float x, float y, float z)
Sets the rotation of a spawned trigger using a quaternion value.
float getVelocityMagnitude(int bodyID)
Use this function to get the speed of the physics body in (meters per second).
void move(int bodyID, float x, float y, float z)
Moves a kinematic Rigidbody by a set amount.