WheelJoint:getMotorTorque takes a dt param instead of inverse dt.

Matches the change made to RevoluteJoint:getMotorTorque.
This commit is contained in:
Sasha Szpakowski
2023-01-13 18:10:45 -04:00
parent a85858236d
commit f6b74e9ce7
3 changed files with 7 additions and 6 deletions
+3 -2
View File
@@ -90,9 +90,10 @@ float WheelJoint::getMaxMotorTorque() const
return Physics::scaleUp(Physics::scaleUp(joint->GetMaxMotorTorque()));
}
float WheelJoint::getMotorTorque(float inv_dt) const
float WheelJoint::getMotorTorque(float dt) const
{
return Physics::scaleUp(Physics::scaleUp(joint->GetMotorTorque(inv_dt)));
float invdt = 1.0f / dt;
return Physics::scaleUp(Physics::scaleUp(joint->GetMotorTorque(invdt)));
}
void WheelJoint::setStiffness(float k)
+2 -2
View File
@@ -91,9 +91,9 @@ public:
/**
* Get the current motor torque, usually in N.
* @param inv_dt The inverse time step.
* @param dt The time step.
**/
float getMotorTorque(float inv_dt) const;
float getMotorTorque(float dt) const;
/**
* Sets the response speed. Dependent of mass
@@ -97,8 +97,8 @@ int w_WheelJoint_getMaxMotorTorque(lua_State *L)
int w_WheelJoint_getMotorTorque(lua_State *L)
{
WheelJoint *t = luax_checkwheeljoint(L, 1);
float inv_dt = (float)luaL_checknumber(L, 2);
lua_pushnumber(L, t->getMotorTorque(inv_dt));
float dt = (float)luaL_checknumber(L, 2);
lua_pushnumber(L, t->getMotorTorque(dt));
return 1;
}