use dt instead of inv_dt in RevoluteJoint::getMotorTorque

This commit is contained in:
megagrump
2021-11-21 01:04:48 +01:00
parent a3ff9999d1
commit 85894ad5e4
3 changed files with 6 additions and 5 deletions
+2 -1
View File
@@ -101,8 +101,9 @@ float RevoluteJoint::getMotorSpeed() const
return joint->GetMotorSpeed();
}
float RevoluteJoint::getMotorTorque(float inv_dt) const
float RevoluteJoint::getMotorTorque(float dt) const
{
float inv_dt = 1.0f / dt;
return Physics::scaleUp(Physics::scaleUp(joint->GetMotorTorque(inv_dt)));
}
+2 -2
View File
@@ -87,9 +87,9 @@ public:
/**
* Get the current motor torque, usually in N-m.
* @param inv_dt The inverse timestep.
* @param dt The timestep.
**/
float getMotorTorque(float inv_dt) const;
float getMotorTorque(float dt) const;
/**
* Get the maximum motor torque, usually in N-m.
@@ -91,8 +91,8 @@ int w_RevoluteJoint_getMotorSpeed(lua_State *L)
int w_RevoluteJoint_getMotorTorque(lua_State *L)
{
RevoluteJoint *t = luax_checkrevolutejoint(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;
}