|
|
@@ -33,6 +33,7 @@ void luaRegister_PhysicsRigidBody()
|
|
|
{"applyTorqueImpulse", lua_PhysicsRigidBody_applyTorqueImpulse},
|
|
|
{"collidesWith", lua_PhysicsRigidBody_collidesWith},
|
|
|
{"getAngularDamping", lua_PhysicsRigidBody_getAngularDamping},
|
|
|
+ {"getAngularFactor", lua_PhysicsRigidBody_getAngularFactor},
|
|
|
{"getAngularVelocity", lua_PhysicsRigidBody_getAngularVelocity},
|
|
|
{"getAnisotropicFriction", lua_PhysicsRigidBody_getAnisotropicFriction},
|
|
|
{"getCollisionShape", lua_PhysicsRigidBody_getCollisionShape},
|
|
|
@@ -40,6 +41,7 @@ void luaRegister_PhysicsRigidBody()
|
|
|
{"getGravity", lua_PhysicsRigidBody_getGravity},
|
|
|
{"getHeight", lua_PhysicsRigidBody_getHeight},
|
|
|
{"getLinearDamping", lua_PhysicsRigidBody_getLinearDamping},
|
|
|
+ {"getLinearFactor", lua_PhysicsRigidBody_getLinearFactor},
|
|
|
{"getLinearVelocity", lua_PhysicsRigidBody_getLinearVelocity},
|
|
|
{"getMass", lua_PhysicsRigidBody_getMass},
|
|
|
{"getNode", lua_PhysicsRigidBody_getNode},
|
|
|
@@ -51,6 +53,7 @@ void luaRegister_PhysicsRigidBody()
|
|
|
{"isKinematic", lua_PhysicsRigidBody_isKinematic},
|
|
|
{"isStatic", lua_PhysicsRigidBody_isStatic},
|
|
|
{"removeCollisionListener", lua_PhysicsRigidBody_removeCollisionListener},
|
|
|
+ {"setAngularFactor", lua_PhysicsRigidBody_setAngularFactor},
|
|
|
{"setAngularVelocity", lua_PhysicsRigidBody_setAngularVelocity},
|
|
|
{"setAnisotropicFriction", lua_PhysicsRigidBody_setAnisotropicFriction},
|
|
|
{"setDamping", lua_PhysicsRigidBody_setDamping},
|
|
|
@@ -58,6 +61,7 @@ void luaRegister_PhysicsRigidBody()
|
|
|
{"setFriction", lua_PhysicsRigidBody_setFriction},
|
|
|
{"setGravity", lua_PhysicsRigidBody_setGravity},
|
|
|
{"setKinematic", lua_PhysicsRigidBody_setKinematic},
|
|
|
+ {"setLinearFactor", lua_PhysicsRigidBody_setLinearFactor},
|
|
|
{"setLinearVelocity", lua_PhysicsRigidBody_setLinearVelocity},
|
|
|
{"setRestitution", lua_PhysicsRigidBody_setRestitution},
|
|
|
{NULL, NULL}
|
|
|
@@ -441,6 +445,52 @@ int lua_PhysicsRigidBody_getAngularDamping(lua_State* state)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+int lua_PhysicsRigidBody_getAngularFactor(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))
|
|
|
+ {
|
|
|
+ PhysicsRigidBody* instance = getInstance(state);
|
|
|
+ void* returnPtr = (void*)new Vector3(instance->getAngularFactor());
|
|
|
+ if (returnPtr)
|
|
|
+ {
|
|
|
+ ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
|
|
|
+ object->instance = returnPtr;
|
|
|
+ object->owns = true;
|
|
|
+ luaL_getmetatable(state, "Vector3");
|
|
|
+ lua_setmetatable(state, -2);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lua_pushnil(state);
|
|
|
+ }
|
|
|
+
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "lua_PhysicsRigidBody_getAngularFactor - 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_PhysicsRigidBody_getAngularVelocity(lua_State* state)
|
|
|
{
|
|
|
// Get the number of parameters.
|
|
|
@@ -775,6 +825,53 @@ int lua_PhysicsRigidBody_getLinearDamping(lua_State* state)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+int lua_PhysicsRigidBody_getLinearFactor(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))
|
|
|
+ {
|
|
|
+ PhysicsRigidBody* instance = getInstance(state);
|
|
|
+ void* returnPtr = (void*)new Vector3(instance->getLinearFactor());
|
|
|
+ if (returnPtr)
|
|
|
+ {
|
|
|
+ ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
|
|
|
+ object->instance = returnPtr;
|
|
|
+ object->owns = true;
|
|
|
+ luaL_getmetatable(state, "Vector3");
|
|
|
+ lua_setmetatable(state, -2);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lua_pushnil(state);
|
|
|
+ }
|
|
|
+
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "lua_PhysicsRigidBody_getLinearFactor - 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_PhysicsRigidBody_getLinearVelocity(lua_State* state)
|
|
|
{
|
|
|
// Get the number of parameters.
|
|
|
@@ -1251,6 +1348,72 @@ int lua_PhysicsRigidBody_removeCollisionListener(lua_State* state)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+int lua_PhysicsRigidBody_setAngularFactor(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_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
|
|
|
+
|
|
|
+ PhysicsRigidBody* instance = getInstance(state);
|
|
|
+ instance->setAngularFactor(*param1);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "lua_PhysicsRigidBody_setAngularFactor - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 4:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ lua_type(state, 2) == LUA_TNUMBER &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER &&
|
|
|
+ lua_type(state, 4) == 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);
|
|
|
+
|
|
|
+ // Get parameter 3 off the stack.
|
|
|
+ float param3 = (float)luaL_checknumber(state, 4);
|
|
|
+
|
|
|
+ PhysicsRigidBody* instance = getInstance(state);
|
|
|
+ instance->setAngularFactor(param1, param2, param3);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "lua_PhysicsRigidBody_setAngularFactor - 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 or 4).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
int lua_PhysicsRigidBody_setAngularVelocity(lua_State* state)
|
|
|
{
|
|
|
// Get the number of parameters.
|
|
|
@@ -1605,6 +1768,72 @@ int lua_PhysicsRigidBody_setKinematic(lua_State* state)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+int lua_PhysicsRigidBody_setLinearFactor(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_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
|
|
|
+
|
|
|
+ PhysicsRigidBody* instance = getInstance(state);
|
|
|
+ instance->setLinearFactor(*param1);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "lua_PhysicsRigidBody_setLinearFactor - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 4:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ lua_type(state, 2) == LUA_TNUMBER &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER &&
|
|
|
+ lua_type(state, 4) == 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);
|
|
|
+
|
|
|
+ // Get parameter 3 off the stack.
|
|
|
+ float param3 = (float)luaL_checknumber(state, 4);
|
|
|
+
|
|
|
+ PhysicsRigidBody* instance = getInstance(state);
|
|
|
+ instance->setLinearFactor(param1, param2, param3);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "lua_PhysicsRigidBody_setLinearFactor - 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 or 4).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
int lua_PhysicsRigidBody_setLinearVelocity(lua_State* state)
|
|
|
{
|
|
|
// Get the number of parameters.
|