mirror of
https://github.com/love2d/love.git
synced 2026-08-19 12:14:20 +02:00
WheelJoint:getMotorTorque takes a dt param instead of inverse dt.
Matches the change made to RevoluteJoint:getMotorTorque.
This commit is contained in:
@@ -90,9 +90,10 @@ float WheelJoint::getMaxMotorTorque() const
|
|||||||
return Physics::scaleUp(Physics::scaleUp(joint->GetMaxMotorTorque()));
|
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)
|
void WheelJoint::setStiffness(float k)
|
||||||
|
|||||||
@@ -91,9 +91,9 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current motor torque, usually in N.
|
* 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
|
* 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)
|
int w_WheelJoint_getMotorTorque(lua_State *L)
|
||||||
{
|
{
|
||||||
WheelJoint *t = luax_checkwheeljoint(L, 1);
|
WheelJoint *t = luax_checkwheeljoint(L, 1);
|
||||||
float inv_dt = (float)luaL_checknumber(L, 2);
|
float dt = (float)luaL_checknumber(L, 2);
|
||||||
lua_pushnumber(L, t->getMotorTorque(inv_dt));
|
lua_pushnumber(L, t->getMotorTorque(dt));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user