Quellcode durchsuchen

Introduce default connection point to make strut rigging easier. An optional offset can be specified relative to the computed default.

Ken Whatmough vor 13 Jahren
Ursprung
Commit
c7cdf04790

+ 5 - 5
gameplay/src/PhysicsVehicle.h

@@ -361,6 +361,11 @@ private:
      */
     void initialize();
 
+    /**
+     * Destructor.
+     */
+    ~PhysicsVehicle();
+
     /**
      * Returns adjusted steering value.
      *
@@ -391,11 +396,6 @@ private:
      */
     void applyDownforce();
 
-    /**
-     * Destructor.
-     */
-    ~PhysicsVehicle();
-
     float _steeringGain;
     float _brakingForce;
     float _drivingForce;

+ 44 - 11
gameplay/src/PhysicsVehicleWheel.cpp

@@ -53,9 +53,9 @@ PhysicsVehicleWheel* PhysicsVehicleWheel::create(Node* node, Properties* propert
         {
             wheel->setWheelAxle(v);
         }
-        else if (strcmp(name, "strutConnectionPoint") == 0 && properties->getVector3(name, &v))
+        else if (strcmp(name, "strutConnectionOffset") == 0 && properties->getVector3(name, &v))
         {
-            wheel->setStrutConnectionPoint(v);
+            wheel->setStrutConnectionOffset(v);
         }
         else if (strcmp(name, "strutRestLength") == 0)
         {
@@ -182,7 +182,6 @@ void PhysicsVehicleWheel::transform(Node* node) const
 {
     GP_ASSERT(_host);
     GP_ASSERT(_host->_vehicle);
-    GP_ASSERT(_host->_node);
 
     const btTransform& trans = _host->_vehicle->getWheelInfo(_indexInHost).m_worldTransform;
     const btVector3& pos = trans.getOrigin();
@@ -191,8 +190,8 @@ void PhysicsVehicleWheel::transform(Node* node) const
     // Use only the component parallel to the defined strut line
     Vector3 strutLine;
     getWheelDirection(&strutLine);
-    Vector3 wheelPos = _initialOffset;
-    _host->_node->getMatrix().transformPoint(&wheelPos);
+    Vector3 wheelPos;
+    getWheelPos(&wheelPos);
     node->setTranslation(wheelPos + strutLine*(strutLine.dot(_positionDelta) / strutLine.lengthSquared()));
 }
 
@@ -200,7 +199,6 @@ void PhysicsVehicleWheel::update(float elapsedTime)
 {
     GP_ASSERT(_host);
     GP_ASSERT(_host->_vehicle);
-    GP_ASSERT(_host->_node);
 
     const btTransform& trans = _host->_vehicle->getWheelInfo(_indexInHost).m_worldTransform;
     const btQuaternion& rot = trans.getRotation();
@@ -208,8 +206,8 @@ void PhysicsVehicleWheel::update(float elapsedTime)
     _orientation.set(rot.x(), rot.y(), rot.z(), rot.w());
 
     Vector3 commandedPosition(pos.x(), pos.y(), pos.z());
-    Vector3 wheelPos = _initialOffset;
-    _host->_node->getMatrix().transformPoint(&wheelPos);
+    Vector3 wheelPos;
+    getWheelPos(&wheelPos);
     commandedPosition -= wheelPos;
 
     // Filter out noise from Bullet
@@ -219,6 +217,34 @@ void PhysicsVehicleWheel::update(float elapsedTime)
     _positionDelta.smooth(commandedPosition, elapsedTime, responseTime);
 }
 
+void PhysicsVehicleWheel::getConnectionDefault(Vector3* result) const
+{
+    // projected strut length
+    getWheelDirection(result);
+    result->normalize();
+    float length = 0.58f * getStrutRestLength();
+    *result *= -length;
+
+    // nudge wheel contact point to outer edge of tire for stability
+    Vector3 nudge;
+    getWheelAxle(&nudge);
+    nudge *= nudge.dot(_initialOffset);
+    nudge.normalize();
+    *result += nudge * 0.068f * getWheelRadius(); // rough-in for tire width
+
+    // offset at bind time
+    *result += _initialOffset;
+}
+
+void PhysicsVehicleWheel::getWheelPos(Vector3* result) const
+{
+    GP_ASSERT(_host);
+    GP_ASSERT(_host->_node);
+
+    *result = _initialOffset;
+    _host->_node->getMatrix().transformPoint(result);
+}
+
 bool PhysicsVehicleWheel::isFront() const
 {
     GP_ASSERT(_host);
@@ -269,19 +295,26 @@ void PhysicsVehicleWheel::setWheelAxle(const Vector3& wheelAxle)
     _host->_vehicle->getWheelInfo(_indexInHost).m_wheelAxleCS.setValue( wheelAxle.x, wheelAxle.y, wheelAxle.z);
 }
 
-void PhysicsVehicleWheel::getStrutConnectionPoint(Vector3* strutConnectionPoint) const
+void PhysicsVehicleWheel::getStrutConnectionOffset(Vector3* strutConnectionOffset) const
 {
     GP_ASSERT(_host);
     GP_ASSERT(_host->_vehicle);
 
     const btVector3& v = _host->_vehicle->getWheelInfo(_indexInHost).m_chassisConnectionPointCS;
-    strutConnectionPoint->set(v.x(), v.y(), v.z());
+    strutConnectionOffset->set(v.x(), v.y(), v.z());
+    Vector3 strutConnectionDefault;
+    getConnectionDefault(&strutConnectionDefault);
+    *strutConnectionOffset -= strutConnectionDefault;
 }
 
-void PhysicsVehicleWheel::setStrutConnectionPoint(const Vector3& strutConnectionPoint)
+void PhysicsVehicleWheel::setStrutConnectionOffset(const Vector3& strutConnectionOffset)
 {
     GP_ASSERT(_host);
     GP_ASSERT(_host->_vehicle);
+
+    Vector3 strutConnectionPoint;
+    getConnectionDefault(&strutConnectionPoint);
+    strutConnectionPoint += strutConnectionOffset;
     _host->_vehicle->getWheelInfo(_indexInHost).m_chassisConnectionPointCS.setValue(strutConnectionPoint.x,
                                                                                     strutConnectionPoint.y,
                                                                                     strutConnectionPoint.z);

+ 42 - 7
gameplay/src/PhysicsVehicleWheel.h

@@ -24,7 +24,7 @@ class PhysicsVehicle;
         isFront                  = <bool>                // indicates whether this is a front wheel
         wheelDirection           = <float, float, float> // direction strut extension, in chassis space
         wheelAxle                = <float, float, float> // direction of axle (spin axis), in chassis space
-        strutConnectionPoint     = <float, float, float> // strut connection point, in chassis space
+        strutConnectionOffset    = <float, float, float> // offset from default strut connection point
         strutRestLength          = <float>               // strut rest length
         strutTravelMax           = <float>               // maximum strut travel
         strutStiffness           = <float>               // strut stiffness, normalized to chassis mass
@@ -103,18 +103,33 @@ public:
     void setWheelAxle(const Vector3& wheelAxle);
 
     /**
-     * Gets strut connection point, in chassis space.
+     * Gets offset from the default strut connection point.
+     * The default strut connection point is determined from the position
+     * of the wheel node relative to the chassis node, and uses the
+     * specified value for strut rest length to locate the connection
+     * point above it (i.e., in the specified direction of strut
+     * compression).
+     * Any non-zero strut connection offset acts as a delta from the
+     * computed default.
      *
-     * @param strutConnectionPoint address of where to store the result.
+     * @param strutConnectionOffset address of where to store the result.
      */
-    void getStrutConnectionPoint(Vector3* strutConnectionPoint) const;
+    void getStrutConnectionOffset(Vector3* strutConnectionOffset) const;
 
     /**
-     * Sets strut connection point, in chassis space.
+     * Sets offset from the default strut connection point.
+     * The default strut connection point is determined from the position
+     * of the wheel node relative to the chassis node, and uses the
+     * specified value for strut rest length to locate the connection
+     * point above it (i.e., in the specified direction of strut
+     * compression).
+     * Any non-zero strutConnectionOffset acts as a delta from the
+     * computed default.
      *
-     * @param strutConnectionPoint strut connection point.
+     * @param strutConnectionOffset offset from the default strut connection
+     *     point.
      */
-    void setStrutConnectionPoint(const Vector3& strutConnectionPoint);
+    void setStrutConnectionOffset(const Vector3& strutConnectionOffset);
 
     /**
      * Gets the strut rest length.
@@ -333,6 +348,26 @@ private:
      */
     void update(float elapsedTime);
 
+    /**
+     * Computes the default strut connection point for
+     * this wheel.
+     * The default strut connection point is determined from the position
+     * of the wheel node relative to the chassis node, and uses the
+     * specified value for maximum strut travel to locate the connection
+     * point above it (i.e., in the specified direction of strut
+     * compression).
+     *
+     * @param result where to store the result.
+     */
+    void getConnectionDefault(Vector3* result) const;
+
+    /**
+     * Get wheel position at bind time relative to chassis.
+     *
+     * @param result where to store the result.
+     */
+    void getWheelPos(Vector3* result) const;
+
     PhysicsRigidBody* _rigidBody;
     PhysicsVehicle* _host;
     unsigned int _indexInHost;

+ 654 - 27
gameplay/src/lua/lua_PhysicsVehicle.cpp

@@ -3,6 +3,7 @@
 #include "lua_PhysicsVehicle.h"
 #include "Base.h"
 #include "Game.h"
+#include "MathUtil.h"
 #include "Node.h"
 #include "PhysicsCollisionObject.h"
 #include "PhysicsController.h"
@@ -23,14 +24,24 @@ void luaRegister_PhysicsVehicle()
         {"addCollisionListener", lua_PhysicsVehicle_addCollisionListener},
         {"addWheel", lua_PhysicsVehicle_addWheel},
         {"collidesWith", lua_PhysicsVehicle_collidesWith},
+        {"getBoostGain", lua_PhysicsVehicle_getBoostGain},
+        {"getBoostSpeed", lua_PhysicsVehicle_getBoostSpeed},
+        {"getBrakedownFull", lua_PhysicsVehicle_getBrakedownFull},
+        {"getBrakedownStart", lua_PhysicsVehicle_getBrakedownStart},
         {"getBrakingForce", lua_PhysicsVehicle_getBrakingForce},
         {"getCollisionShape", lua_PhysicsVehicle_getCollisionShape},
+        {"getDownforce", lua_PhysicsVehicle_getDownforce},
+        {"getDrivedownFull", lua_PhysicsVehicle_getDrivedownFull},
+        {"getDrivedownStart", lua_PhysicsVehicle_getDrivedownStart},
         {"getDrivingForce", lua_PhysicsVehicle_getDrivingForce},
         {"getNode", lua_PhysicsVehicle_getNode},
         {"getNumWheels", lua_PhysicsVehicle_getNumWheels},
         {"getRigidBody", lua_PhysicsVehicle_getRigidBody},
         {"getShapeType", lua_PhysicsVehicle_getShapeType},
         {"getSpeedKph", lua_PhysicsVehicle_getSpeedKph},
+        {"getSpeedSmoothKph", lua_PhysicsVehicle_getSpeedSmoothKph},
+        {"getSteerdownGain", lua_PhysicsVehicle_getSteerdownGain},
+        {"getSteerdownSpeed", lua_PhysicsVehicle_getSteerdownSpeed},
         {"getSteeringGain", lua_PhysicsVehicle_getSteeringGain},
         {"getType", lua_PhysicsVehicle_getType},
         {"getWheel", lua_PhysicsVehicle_getWheel},
@@ -38,9 +49,15 @@ void luaRegister_PhysicsVehicle()
         {"isEnabled", lua_PhysicsVehicle_isEnabled},
         {"isKinematic", lua_PhysicsVehicle_isKinematic},
         {"removeCollisionListener", lua_PhysicsVehicle_removeCollisionListener},
+        {"reset", lua_PhysicsVehicle_reset},
+        {"setBoost", lua_PhysicsVehicle_setBoost},
+        {"setBrakedown", lua_PhysicsVehicle_setBrakedown},
         {"setBrakingForce", lua_PhysicsVehicle_setBrakingForce},
+        {"setDownforce", lua_PhysicsVehicle_setDownforce},
+        {"setDrivedown", lua_PhysicsVehicle_setDrivedown},
         {"setDrivingForce", lua_PhysicsVehicle_setDrivingForce},
         {"setEnabled", lua_PhysicsVehicle_setEnabled},
+        {"setSteerdown", lua_PhysicsVehicle_setSteerdown},
         {"setSteeringGain", lua_PhysicsVehicle_setSteeringGain},
         {"update", lua_PhysicsVehicle_update},
         {NULL, NULL}
@@ -225,6 +242,154 @@ int lua_PhysicsVehicle_collidesWith(lua_State* state)
     return 0;
 }
 
+int lua_PhysicsVehicle_getBoostGain(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                PhysicsVehicle* instance = getInstance(state);
+                float result = instance->getBoostGain();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsVehicle_getBoostGain - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_PhysicsVehicle_getBoostSpeed(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                PhysicsVehicle* instance = getInstance(state);
+                float result = instance->getBoostSpeed();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsVehicle_getBoostSpeed - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_PhysicsVehicle_getBrakedownFull(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                PhysicsVehicle* instance = getInstance(state);
+                float result = instance->getBrakedownFull();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsVehicle_getBrakedownFull - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_PhysicsVehicle_getBrakedownStart(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                PhysicsVehicle* instance = getInstance(state);
+                float result = instance->getBrakedownStart();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsVehicle_getBrakedownStart - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_PhysicsVehicle_getBrakingForce(lua_State* state)
 {
     // Get the number of parameters.
@@ -308,6 +473,117 @@ int lua_PhysicsVehicle_getCollisionShape(lua_State* state)
     return 0;
 }
 
+int lua_PhysicsVehicle_getDownforce(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                PhysicsVehicle* instance = getInstance(state);
+                float result = instance->getDownforce();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsVehicle_getDownforce - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_PhysicsVehicle_getDrivedownFull(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                PhysicsVehicle* instance = getInstance(state);
+                float result = instance->getDrivedownFull();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsVehicle_getDrivedownFull - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_PhysicsVehicle_getDrivedownStart(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                PhysicsVehicle* instance = getInstance(state);
+                float result = instance->getDrivedownStart();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsVehicle_getDrivedownStart - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_PhysicsVehicle_getDrivingForce(lua_State* state)
 {
     // Get the number of parameters.
@@ -376,7 +652,127 @@ int lua_PhysicsVehicle_getNode(lua_State* state)
             }
             else
             {
-                lua_pushstring(state, "lua_PhysicsVehicle_getNode - Failed to match the given parameters to a valid function signature.");
+                lua_pushstring(state, "lua_PhysicsVehicle_getNode - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_PhysicsVehicle_getNumWheels(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                PhysicsVehicle* instance = getInstance(state);
+                unsigned int result = instance->getNumWheels();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsVehicle_getNumWheels - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_PhysicsVehicle_getRigidBody(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                PhysicsVehicle* instance = getInstance(state);
+                void* returnPtr = (void*)instance->getRigidBody();
+                if (returnPtr)
+                {
+                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "PhysicsRigidBody");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsVehicle_getRigidBody - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_PhysicsVehicle_getShapeType(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                PhysicsVehicle* instance = getInstance(state);
+                PhysicsCollisionShape::Type result = instance->getShapeType();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, lua_stringFromEnum_PhysicsCollisionShapeType(result));
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsVehicle_getShapeType - Failed to match the given parameters to a valid function signature.");
                 lua_error(state);
             }
             break;
@@ -391,7 +787,7 @@ int lua_PhysicsVehicle_getNode(lua_State* state)
     return 0;
 }
 
-int lua_PhysicsVehicle_getNumWheels(lua_State* state)
+int lua_PhysicsVehicle_getSpeedKph(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -404,16 +800,16 @@ int lua_PhysicsVehicle_getNumWheels(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
                 PhysicsVehicle* instance = getInstance(state);
-                unsigned int result = instance->getNumWheels();
+                float result = instance->getSpeedKph();
 
                 // Push the return value onto the stack.
-                lua_pushunsigned(state, result);
+                lua_pushnumber(state, result);
 
                 return 1;
             }
             else
             {
-                lua_pushstring(state, "lua_PhysicsVehicle_getNumWheels - Failed to match the given parameters to a valid function signature.");
+                lua_pushstring(state, "lua_PhysicsVehicle_getSpeedKph - Failed to match the given parameters to a valid function signature.");
                 lua_error(state);
             }
             break;
@@ -428,7 +824,7 @@ int lua_PhysicsVehicle_getNumWheels(lua_State* state)
     return 0;
 }
 
-int lua_PhysicsVehicle_getRigidBody(lua_State* state)
+int lua_PhysicsVehicle_getSpeedSmoothKph(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -441,25 +837,16 @@ int lua_PhysicsVehicle_getRigidBody(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
                 PhysicsVehicle* instance = getInstance(state);
-                void* returnPtr = (void*)instance->getRigidBody();
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "PhysicsRigidBody");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
+                float result = instance->getSpeedSmoothKph();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
 
                 return 1;
             }
             else
             {
-                lua_pushstring(state, "lua_PhysicsVehicle_getRigidBody - Failed to match the given parameters to a valid function signature.");
+                lua_pushstring(state, "lua_PhysicsVehicle_getSpeedSmoothKph - Failed to match the given parameters to a valid function signature.");
                 lua_error(state);
             }
             break;
@@ -474,7 +861,7 @@ int lua_PhysicsVehicle_getRigidBody(lua_State* state)
     return 0;
 }
 
-int lua_PhysicsVehicle_getShapeType(lua_State* state)
+int lua_PhysicsVehicle_getSteerdownGain(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -487,16 +874,16 @@ int lua_PhysicsVehicle_getShapeType(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
                 PhysicsVehicle* instance = getInstance(state);
-                PhysicsCollisionShape::Type result = instance->getShapeType();
+                float result = instance->getSteerdownGain();
 
                 // Push the return value onto the stack.
-                lua_pushstring(state, lua_stringFromEnum_PhysicsCollisionShapeType(result));
+                lua_pushnumber(state, result);
 
                 return 1;
             }
             else
             {
-                lua_pushstring(state, "lua_PhysicsVehicle_getShapeType - Failed to match the given parameters to a valid function signature.");
+                lua_pushstring(state, "lua_PhysicsVehicle_getSteerdownGain - Failed to match the given parameters to a valid function signature.");
                 lua_error(state);
             }
             break;
@@ -511,7 +898,7 @@ int lua_PhysicsVehicle_getShapeType(lua_State* state)
     return 0;
 }
 
-int lua_PhysicsVehicle_getSpeedKph(lua_State* state)
+int lua_PhysicsVehicle_getSteerdownSpeed(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -524,7 +911,7 @@ int lua_PhysicsVehicle_getSpeedKph(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
                 PhysicsVehicle* instance = getInstance(state);
-                float result = instance->getSpeedKph();
+                float result = instance->getSteerdownSpeed();
 
                 // Push the return value onto the stack.
                 lua_pushnumber(state, result);
@@ -533,7 +920,7 @@ int lua_PhysicsVehicle_getSpeedKph(lua_State* state)
             }
             else
             {
-                lua_pushstring(state, "lua_PhysicsVehicle_getSpeedKph - Failed to match the given parameters to a valid function signature.");
+                lua_pushstring(state, "lua_PhysicsVehicle_getSteerdownSpeed - Failed to match the given parameters to a valid function signature.");
                 lua_error(state);
             }
             break;
@@ -871,6 +1258,124 @@ int lua_PhysicsVehicle_removeCollisionListener(lua_State* state)
     return 0;
 }
 
+int lua_PhysicsVehicle_reset(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                PhysicsVehicle* instance = getInstance(state);
+                instance->reset();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsVehicle_reset - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_PhysicsVehicle_setBoost(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 3:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                PhysicsVehicle* instance = getInstance(state);
+                instance->setBoost(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsVehicle_setBoost - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_PhysicsVehicle_setBrakedown(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 3:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                PhysicsVehicle* instance = getInstance(state);
+                instance->setBrakedown(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsVehicle_setBrakedown - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_PhysicsVehicle_setBrakingForce(lua_State* state)
 {
     // Get the number of parameters.
@@ -909,6 +1414,86 @@ int lua_PhysicsVehicle_setBrakingForce(lua_State* state)
     return 0;
 }
 
+int lua_PhysicsVehicle_setDownforce(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                PhysicsVehicle* instance = getInstance(state);
+                instance->setDownforce(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsVehicle_setDownforce - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_PhysicsVehicle_setDrivedown(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 3:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                PhysicsVehicle* instance = getInstance(state);
+                instance->setDrivedown(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsVehicle_setDrivedown - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_PhysicsVehicle_setDrivingForce(lua_State* state)
 {
     // Get the number of parameters.
@@ -985,6 +1570,48 @@ int lua_PhysicsVehicle_setEnabled(lua_State* state)
     return 0;
 }
 
+int lua_PhysicsVehicle_setSteerdown(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 3:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                PhysicsVehicle* instance = getInstance(state);
+                instance->setSteerdown(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsVehicle_setSteerdown - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_PhysicsVehicle_setSteeringGain(lua_State* state)
 {
     // Get the number of parameters.

+ 16 - 0
gameplay/src/lua/lua_PhysicsVehicle.h

@@ -8,14 +8,24 @@ namespace gameplay
 int lua_PhysicsVehicle_addCollisionListener(lua_State* state);
 int lua_PhysicsVehicle_addWheel(lua_State* state);
 int lua_PhysicsVehicle_collidesWith(lua_State* state);
+int lua_PhysicsVehicle_getBoostGain(lua_State* state);
+int lua_PhysicsVehicle_getBoostSpeed(lua_State* state);
+int lua_PhysicsVehicle_getBrakedownFull(lua_State* state);
+int lua_PhysicsVehicle_getBrakedownStart(lua_State* state);
 int lua_PhysicsVehicle_getBrakingForce(lua_State* state);
 int lua_PhysicsVehicle_getCollisionShape(lua_State* state);
+int lua_PhysicsVehicle_getDownforce(lua_State* state);
+int lua_PhysicsVehicle_getDrivedownFull(lua_State* state);
+int lua_PhysicsVehicle_getDrivedownStart(lua_State* state);
 int lua_PhysicsVehicle_getDrivingForce(lua_State* state);
 int lua_PhysicsVehicle_getNode(lua_State* state);
 int lua_PhysicsVehicle_getNumWheels(lua_State* state);
 int lua_PhysicsVehicle_getRigidBody(lua_State* state);
 int lua_PhysicsVehicle_getShapeType(lua_State* state);
 int lua_PhysicsVehicle_getSpeedKph(lua_State* state);
+int lua_PhysicsVehicle_getSpeedSmoothKph(lua_State* state);
+int lua_PhysicsVehicle_getSteerdownGain(lua_State* state);
+int lua_PhysicsVehicle_getSteerdownSpeed(lua_State* state);
 int lua_PhysicsVehicle_getSteeringGain(lua_State* state);
 int lua_PhysicsVehicle_getType(lua_State* state);
 int lua_PhysicsVehicle_getWheel(lua_State* state);
@@ -23,9 +33,15 @@ int lua_PhysicsVehicle_isDynamic(lua_State* state);
 int lua_PhysicsVehicle_isEnabled(lua_State* state);
 int lua_PhysicsVehicle_isKinematic(lua_State* state);
 int lua_PhysicsVehicle_removeCollisionListener(lua_State* state);
+int lua_PhysicsVehicle_reset(lua_State* state);
+int lua_PhysicsVehicle_setBoost(lua_State* state);
+int lua_PhysicsVehicle_setBrakedown(lua_State* state);
 int lua_PhysicsVehicle_setBrakingForce(lua_State* state);
+int lua_PhysicsVehicle_setDownforce(lua_State* state);
+int lua_PhysicsVehicle_setDrivedown(lua_State* state);
 int lua_PhysicsVehicle_setDrivingForce(lua_State* state);
 int lua_PhysicsVehicle_setEnabled(lua_State* state);
+int lua_PhysicsVehicle_setSteerdown(lua_State* state);
 int lua_PhysicsVehicle_setSteeringGain(lua_State* state);
 int lua_PhysicsVehicle_update(lua_State* state);
 

+ 8 - 8
gameplay/src/lua/lua_PhysicsVehicleWheel.cpp

@@ -27,7 +27,7 @@ void luaRegister_PhysicsVehicleWheel()
         {"getNode", lua_PhysicsVehicleWheel_getNode},
         {"getRollInfluence", lua_PhysicsVehicleWheel_getRollInfluence},
         {"getShapeType", lua_PhysicsVehicleWheel_getShapeType},
-        {"getStrutConnectionPoint", lua_PhysicsVehicleWheel_getStrutConnectionPoint},
+        {"getStrutConnectionOffset", lua_PhysicsVehicleWheel_getStrutConnectionOffset},
         {"getStrutDampingCompression", lua_PhysicsVehicleWheel_getStrutDampingCompression},
         {"getStrutDampingRelaxation", lua_PhysicsVehicleWheel_getStrutDampingRelaxation},
         {"getStrutForceMax", lua_PhysicsVehicleWheel_getStrutForceMax},
@@ -47,7 +47,7 @@ void luaRegister_PhysicsVehicleWheel()
         {"setFrictionBreakout", lua_PhysicsVehicleWheel_setFrictionBreakout},
         {"setFront", lua_PhysicsVehicleWheel_setFront},
         {"setRollInfluence", lua_PhysicsVehicleWheel_setRollInfluence},
-        {"setStrutConnectionPoint", lua_PhysicsVehicleWheel_setStrutConnectionPoint},
+        {"setStrutConnectionOffset", lua_PhysicsVehicleWheel_setStrutConnectionOffset},
         {"setStrutDampingCompression", lua_PhysicsVehicleWheel_setStrutDampingCompression},
         {"setStrutDampingRelaxation", lua_PhysicsVehicleWheel_setStrutDampingRelaxation},
         {"setStrutForceMax", lua_PhysicsVehicleWheel_setStrutForceMax},
@@ -405,7 +405,7 @@ int lua_PhysicsVehicleWheel_getShapeType(lua_State* state)
     return 0;
 }
 
-int lua_PhysicsVehicleWheel_getStrutConnectionPoint(lua_State* state)
+int lua_PhysicsVehicleWheel_getStrutConnectionOffset(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -422,13 +422,13 @@ int lua_PhysicsVehicleWheel_getStrutConnectionPoint(lua_State* state)
                 ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false);
 
                 PhysicsVehicleWheel* instance = getInstance(state);
-                instance->getStrutConnectionPoint(param1);
+                instance->getStrutConnectionOffset(param1);
                 
                 return 0;
             }
             else
             {
-                lua_pushstring(state, "lua_PhysicsVehicleWheel_getStrutConnectionPoint - Failed to match the given parameters to a valid function signature.");
+                lua_pushstring(state, "lua_PhysicsVehicleWheel_getStrutConnectionOffset - Failed to match the given parameters to a valid function signature.");
                 lua_error(state);
             }
             break;
@@ -1203,7 +1203,7 @@ int lua_PhysicsVehicleWheel_setRollInfluence(lua_State* state)
     return 0;
 }
 
-int lua_PhysicsVehicleWheel_setStrutConnectionPoint(lua_State* state)
+int lua_PhysicsVehicleWheel_setStrutConnectionOffset(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -1220,13 +1220,13 @@ int lua_PhysicsVehicleWheel_setStrutConnectionPoint(lua_State* state)
                 ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
 
                 PhysicsVehicleWheel* instance = getInstance(state);
-                instance->setStrutConnectionPoint(*param1);
+                instance->setStrutConnectionOffset(*param1);
                 
                 return 0;
             }
             else
             {
-                lua_pushstring(state, "lua_PhysicsVehicleWheel_setStrutConnectionPoint - Failed to match the given parameters to a valid function signature.");
+                lua_pushstring(state, "lua_PhysicsVehicleWheel_setStrutConnectionOffset - Failed to match the given parameters to a valid function signature.");
                 lua_error(state);
             }
             break;

+ 2 - 2
gameplay/src/lua/lua_PhysicsVehicleWheel.h

@@ -12,7 +12,7 @@ int lua_PhysicsVehicleWheel_getFrictionBreakout(lua_State* state);
 int lua_PhysicsVehicleWheel_getNode(lua_State* state);
 int lua_PhysicsVehicleWheel_getRollInfluence(lua_State* state);
 int lua_PhysicsVehicleWheel_getShapeType(lua_State* state);
-int lua_PhysicsVehicleWheel_getStrutConnectionPoint(lua_State* state);
+int lua_PhysicsVehicleWheel_getStrutConnectionOffset(lua_State* state);
 int lua_PhysicsVehicleWheel_getStrutDampingCompression(lua_State* state);
 int lua_PhysicsVehicleWheel_getStrutDampingRelaxation(lua_State* state);
 int lua_PhysicsVehicleWheel_getStrutForceMax(lua_State* state);
@@ -32,7 +32,7 @@ int lua_PhysicsVehicleWheel_setEnabled(lua_State* state);
 int lua_PhysicsVehicleWheel_setFrictionBreakout(lua_State* state);
 int lua_PhysicsVehicleWheel_setFront(lua_State* state);
 int lua_PhysicsVehicleWheel_setRollInfluence(lua_State* state);
-int lua_PhysicsVehicleWheel_setStrutConnectionPoint(lua_State* state);
+int lua_PhysicsVehicleWheel_setStrutConnectionOffset(lua_State* state);
 int lua_PhysicsVehicleWheel_setStrutDampingCompression(lua_State* state);
 int lua_PhysicsVehicleWheel_setStrutDampingRelaxation(lua_State* state);
 int lua_PhysicsVehicleWheel_setStrutForceMax(lua_State* state);