mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
updating the Joints
--HG-- branch : box2d-update
This commit is contained in:
@@ -46,32 +46,32 @@ namespace box2d
|
|||||||
|
|
||||||
void DistanceJoint::setLength(float length)
|
void DistanceJoint::setLength(float length)
|
||||||
{
|
{
|
||||||
joint->m_length = world->scaleDown(length);
|
joint->SetLength(world->scaleDown(length));
|
||||||
}
|
}
|
||||||
|
|
||||||
float DistanceJoint::getLength() const
|
float DistanceJoint::getLength() const
|
||||||
{
|
{
|
||||||
return world->scaleUp(joint->m_length);
|
return world->scaleUp(joint->GetLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DistanceJoint::setFrequency(float hz)
|
void DistanceJoint::setFrequency(float hz)
|
||||||
{
|
{
|
||||||
joint->m_frequencyHz = hz;
|
joint->SetFrequency(hz);
|
||||||
}
|
}
|
||||||
|
|
||||||
float DistanceJoint::getFrequency() const
|
float DistanceJoint::getFrequency() const
|
||||||
{
|
{
|
||||||
return joint->m_frequencyHz;
|
return joint->GetFrequency();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DistanceJoint::setDampingRatio(float d)
|
void DistanceJoint::setDampingRatio(float d)
|
||||||
{
|
{
|
||||||
joint->m_dampingRatio = d;
|
joint->SetDampingRatio(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
float DistanceJoint::getDampingRatio() const
|
float DistanceJoint::getDampingRatio() const
|
||||||
{
|
{
|
||||||
return joint->m_dampingRatio;
|
return joint->GetDampingRatio();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ namespace box2d
|
|||||||
b2GearJointDef def;
|
b2GearJointDef def;
|
||||||
def.joint1 = joint1->joint;
|
def.joint1 = joint1->joint;
|
||||||
def.joint2 = joint2->joint;
|
def.joint2 = joint2->joint;
|
||||||
def.body1 = joint1->body2->body;
|
def.bodyA = joint1->body2->body;
|
||||||
def.body2 = joint2->body2->body;
|
def.bodyB = joint2->body2->body;
|
||||||
def.ratio = ratio;
|
def.ratio = ratio;
|
||||||
|
|
||||||
joint = (b2GearJoint*)createJoint(&def);
|
joint = (b2GearJoint*)createJoint(&def);
|
||||||
@@ -51,12 +51,12 @@ namespace box2d
|
|||||||
|
|
||||||
void GearJoint::setRatio(float ratio)
|
void GearJoint::setRatio(float ratio)
|
||||||
{
|
{
|
||||||
joint->m_ratio = ratio;
|
joint->SetRatio(ratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
float GearJoint::getRatio() const
|
float GearJoint::getRatio() const
|
||||||
{
|
{
|
||||||
return joint->m_ratio;
|
return joint->GetRatio();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // box2d
|
} // box2d
|
||||||
|
|||||||
@@ -79,34 +79,25 @@ namespace box2d
|
|||||||
|
|
||||||
int Joint::getAnchors(lua_State * L)
|
int Joint::getAnchors(lua_State * L)
|
||||||
{
|
{
|
||||||
lua_pushnumber(L, world->scaleUp(joint->GetAnchor1().x));
|
lua_pushnumber(L, world->scaleUp(joint->GetAnchorA().x));
|
||||||
lua_pushnumber(L, world->scaleUp(joint->GetAnchor1().y));
|
lua_pushnumber(L, world->scaleUp(joint->GetAnchorA().y));
|
||||||
lua_pushnumber(L, world->scaleUp(joint->GetAnchor2().x));
|
lua_pushnumber(L, world->scaleUp(joint->GetAnchorB().x));
|
||||||
lua_pushnumber(L, world->scaleUp(joint->GetAnchor2().y));
|
lua_pushnumber(L, world->scaleUp(joint->GetAnchorB().y));
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Joint::getReactionForce(lua_State * L)
|
int Joint::getReactionForce(lua_State * L)
|
||||||
{
|
{
|
||||||
b2Vec2 v = joint->GetReactionForce();
|
float dt = (float)luaL_checknumber(L, 2);
|
||||||
|
b2Vec2 v = joint->GetReactionForce(dt);
|
||||||
lua_pushnumber(L, v.x);
|
lua_pushnumber(L, v.x);
|
||||||
lua_pushnumber(L, v.y);
|
lua_pushnumber(L, v.y);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Joint::getReactionTorque()
|
float Joint::getReactionTorque(float dt)
|
||||||
{
|
{
|
||||||
return joint->GetReactionTorque();
|
return joint->GetReactionTorque(dt);
|
||||||
}
|
|
||||||
|
|
||||||
void Joint::setCollideConnected(bool collide)
|
|
||||||
{
|
|
||||||
joint->m_collideConnected = collide;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Joint::getCollideConnected() const
|
|
||||||
{
|
|
||||||
return joint->m_collideConnected;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
b2Joint * Joint::createJoint(b2JointDef * def)
|
b2Joint * Joint::createJoint(b2JointDef * def)
|
||||||
|
|||||||
@@ -97,19 +97,7 @@ namespace box2d
|
|||||||
/**
|
/**
|
||||||
* Gets the reaction torque on body2.
|
* Gets the reaction torque on body2.
|
||||||
**/
|
**/
|
||||||
float getReactionTorque();
|
float getReactionTorque(float dt);
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets whether connected bodies should collide
|
|
||||||
* or not. Default is false.
|
|
||||||
**/
|
|
||||||
void setCollideConnected(bool collide);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets whether connected bodies should collide
|
|
||||||
* or not.
|
|
||||||
**/
|
|
||||||
bool getCollideConnected() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ namespace box2d
|
|||||||
{
|
{
|
||||||
b2MouseJointDef def;
|
b2MouseJointDef def;
|
||||||
|
|
||||||
def.body1 = body1->world->world->GetGroundBody();
|
def.bodyA = body1->world->getGroundBody();
|
||||||
def.body2 = body1->body;
|
def.bodyB = body1->body;
|
||||||
def.maxForce = 1000.0f * body1->body->GetMass();
|
def.maxForce = 1000.0f * body1->body->GetMass();
|
||||||
def.target = body1->world->scaleDown(b2Vec2(x,y));
|
def.target = body1->world->scaleDown(b2Vec2(x,y));
|
||||||
joint = (b2MouseJoint*)createJoint(&def);
|
joint = (b2MouseJoint*)createJoint(&def);
|
||||||
@@ -55,19 +55,19 @@ namespace box2d
|
|||||||
|
|
||||||
int MouseJoint::getTarget(lua_State * L)
|
int MouseJoint::getTarget(lua_State * L)
|
||||||
{
|
{
|
||||||
lua_pushnumber(L, world->scaleUp(joint->m_target.x));
|
lua_pushnumber(L, world->scaleUp(joint->GetTarget().x));
|
||||||
lua_pushnumber(L, world->scaleUp(joint->m_target.y));
|
lua_pushnumber(L, world->scaleUp(joint->GetTarget().y));
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MouseJoint::setMaxForce(float force)
|
void MouseJoint::setMaxForce(float force)
|
||||||
{
|
{
|
||||||
joint->m_maxForce = force;
|
joint->SetMaxForce(force);
|
||||||
}
|
}
|
||||||
|
|
||||||
float MouseJoint::getMaxForce() const
|
float MouseJoint::getMaxForce() const
|
||||||
{
|
{
|
||||||
return joint->m_maxForce;
|
return joint->GetMaxForce();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // box2d
|
} // box2d
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ namespace box2d
|
|||||||
if(count < 3)
|
if(count < 3)
|
||||||
return luaL_error(L, "Polygon degenerated to less than three points.");
|
return luaL_error(L, "Polygon degenerated to less than three points.");
|
||||||
|
|
||||||
b2vec2 vecs[] = new b2vec2[count];
|
b2Vec2 vecs[] = new b2vec2[count];
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
vecs[i].Set(convex_hull[i].x, convex_hull[i].y);
|
vecs[i].Set(convex_hull[i].x, convex_hull[i].y);
|
||||||
|
|||||||
@@ -73,11 +73,6 @@ namespace box2d
|
|||||||
joint->SetMaxMotorForce(force);
|
joint->SetMaxMotorForce(force);
|
||||||
}
|
}
|
||||||
|
|
||||||
float PrismaticJoint::getMaxMotorForce() const
|
|
||||||
{
|
|
||||||
return joint->m_maxMotorForce;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PrismaticJoint::setMotorSpeed(float speed)
|
void PrismaticJoint::setMotorSpeed(float speed)
|
||||||
{
|
{
|
||||||
joint->SetMotorSpeed(speed);
|
joint->SetMotorSpeed(speed);
|
||||||
|
|||||||
@@ -75,11 +75,6 @@ namespace box2d
|
|||||||
**/
|
**/
|
||||||
void setMaxMotorForce(float force);
|
void setMaxMotorForce(float force);
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the current motor force, usually in N.
|
|
||||||
**/
|
|
||||||
float getMaxMotorForce() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the motor speed, usually in meters per second.
|
* Set the motor speed, usually in meters per second.
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -48,49 +48,13 @@ namespace box2d
|
|||||||
|
|
||||||
int PulleyJoint::getGroundAnchors(lua_State * L)
|
int PulleyJoint::getGroundAnchors(lua_State * L)
|
||||||
{
|
{
|
||||||
lua_pushnumber(L, world->scaleUp(joint->GetGroundAnchor1().x));
|
lua_pushnumber(L, world->scaleUp(joint->GetGroundAnchorA().x));
|
||||||
lua_pushnumber(L, world->scaleUp(joint->GetGroundAnchor1().y));
|
lua_pushnumber(L, world->scaleUp(joint->GetGroundAnchorA().y));
|
||||||
lua_pushnumber(L, world->scaleUp(joint->GetGroundAnchor2().x));
|
lua_pushnumber(L, world->scaleUp(joint->GetGroundAnchorB().x));
|
||||||
lua_pushnumber(L, world->scaleUp(joint->GetGroundAnchor2().y));
|
lua_pushnumber(L, world->scaleUp(joint->GetGroundAnchorB().y));
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PulleyJoint::setMaxLengths(float maxlength1, float maxlength2)
|
|
||||||
{
|
|
||||||
// Apply Box2D's maximum lengths too. They know better.
|
|
||||||
|
|
||||||
if (maxlength1 > 0)
|
|
||||||
{
|
|
||||||
joint->m_maxLength1 = b2Min(world->scaleDown(maxlength1), joint->m_constant - joint->m_ratio * b2_minPulleyLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxlength2 > 0)
|
|
||||||
{
|
|
||||||
joint->m_maxLength2 = b2Min(world->scaleDown(maxlength2), (joint->m_constant - b2_minPulleyLength) / joint->m_ratio);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int PulleyJoint::getMaxLengths(lua_State * L)
|
|
||||||
{
|
|
||||||
lua_pushnumber(L, world->scaleUp(joint->m_maxLength1));
|
|
||||||
lua_pushnumber(L, world->scaleUp(joint->m_maxLength2));
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PulleyJoint::setConstant(float constant)
|
|
||||||
{
|
|
||||||
joint->m_constant = world->scaleDown(constant);
|
|
||||||
|
|
||||||
// Update the max lengths, as does Box2D
|
|
||||||
joint->m_maxLength1 = joint->m_constant - joint->m_ratio * b2_minPulleyLength;
|
|
||||||
joint->m_maxLength2 = (joint->m_constant - b2_minPulleyLength) / joint->m_ratio;
|
|
||||||
}
|
|
||||||
|
|
||||||
float PulleyJoint::getConstant() const
|
|
||||||
{
|
|
||||||
return world->scaleUp(joint->m_constant);
|
|
||||||
}
|
|
||||||
|
|
||||||
float PulleyJoint::getLength1() const
|
float PulleyJoint::getLength1() const
|
||||||
{
|
{
|
||||||
return world->scaleUp(joint->GetLength1());
|
return world->scaleUp(joint->GetLength1());
|
||||||
@@ -101,14 +65,9 @@ namespace box2d
|
|||||||
return world->scaleUp(joint->GetLength2());
|
return world->scaleUp(joint->GetLength2());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PulleyJoint::setRatio(float ratio)
|
|
||||||
{
|
|
||||||
joint->m_ratio = ratio;
|
|
||||||
}
|
|
||||||
|
|
||||||
float PulleyJoint::getRatio() const
|
float PulleyJoint::getRatio() const
|
||||||
{
|
{
|
||||||
return joint->m_ratio;
|
return joint->GetRatio();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // box2d
|
} // box2d
|
||||||
|
|||||||
@@ -56,29 +56,6 @@ namespace box2d
|
|||||||
**/
|
**/
|
||||||
int getGroundAnchors(lua_State * L);
|
int getGroundAnchors(lua_State * L);
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the max rope lengths (a value of zero keeps it
|
|
||||||
* unchanged). Beware that Box2D also imposes a maximum,
|
|
||||||
* so the smallest of these is actually set.
|
|
||||||
**/
|
|
||||||
void setMaxLengths(float maxlength1, float maxlength2);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the max rope lengths.
|
|
||||||
**/
|
|
||||||
int getMaxLengths(lua_State * L);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the total length of the rope and updates the
|
|
||||||
* MaxLengths values accordingly.
|
|
||||||
**/
|
|
||||||
void setConstant(float length);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the total length of the rope.
|
|
||||||
**/
|
|
||||||
float getConstant() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current length of the segment attached to body1.
|
* Gets the current length of the segment attached to body1.
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -71,11 +71,6 @@ namespace box2d
|
|||||||
joint->SetMaxMotorTorque(torque);
|
joint->SetMaxMotorTorque(torque);
|
||||||
}
|
}
|
||||||
|
|
||||||
float RevoluteJoint::getMaxMotorTorque() const
|
|
||||||
{
|
|
||||||
return joint->m_maxMotorTorque;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RevoluteJoint::setMotorSpeed(float speed)
|
void RevoluteJoint::setMotorSpeed(float speed)
|
||||||
{
|
{
|
||||||
joint->SetMotorSpeed(speed);
|
joint->SetMotorSpeed(speed);
|
||||||
|
|||||||
@@ -75,11 +75,6 @@ namespace box2d
|
|||||||
**/
|
**/
|
||||||
void setMaxMotorTorque(float torque);
|
void setMaxMotorTorque(float torque);
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the maximum motor torque, usually in N-m.
|
|
||||||
**/
|
|
||||||
float getMaxMotorTorque() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the motor speed in degrees per second.
|
* Sets the motor speed in degrees per second.
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -100,6 +100,8 @@ namespace box2d
|
|||||||
{
|
{
|
||||||
world = new b2World(scaleDown(aabb), b2Vec2(0,0), true);
|
world = new b2World(scaleDown(aabb), b2Vec2(0,0), true);
|
||||||
world->SetContactListener(this);
|
world->SetContactListener(this);
|
||||||
|
b2BodyDef def;
|
||||||
|
groundBody = world->CreateBody(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
World::World(b2AABB aabb, b2Vec2 gravity, bool sleep, int meter)
|
World::World(b2AABB aabb, b2Vec2 gravity, bool sleep, int meter)
|
||||||
@@ -111,6 +113,7 @@ namespace box2d
|
|||||||
|
|
||||||
World::~World()
|
World::~World()
|
||||||
{
|
{
|
||||||
|
world->DestroyBody(groundBody);
|
||||||
delete world;
|
delete world;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,6 +276,11 @@ namespace box2d
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b2Body * World::getGroundBody()
|
||||||
|
{
|
||||||
|
return groundBody;
|
||||||
|
}
|
||||||
|
|
||||||
} // box2d
|
} // box2d
|
||||||
} // physics
|
} // physics
|
||||||
} // love
|
} // love
|
||||||
|
|||||||
@@ -78,6 +78,9 @@ namespace box2d
|
|||||||
// Pointer to the Box2D world.
|
// Pointer to the Box2D world.
|
||||||
b2World * world;
|
b2World * world;
|
||||||
|
|
||||||
|
// Ground body
|
||||||
|
b2Body * groundBody;
|
||||||
|
|
||||||
// Contact callbacks.
|
// Contact callbacks.
|
||||||
ContactCallback add, persist, remove, result;
|
ContactCallback add, persist, remove, result;
|
||||||
|
|
||||||
@@ -242,6 +245,12 @@ namespace box2d
|
|||||||
**/
|
**/
|
||||||
b2AABB scaleUp(const b2AABB & aabb);
|
b2AABB scaleUp(const b2AABB & aabb);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the ground body.
|
||||||
|
* @return The ground body.
|
||||||
|
**/
|
||||||
|
b2Body * getGroundBody();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // box2d
|
} // box2d
|
||||||
|
|||||||
@@ -68,13 +68,6 @@ namespace box2d
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_PrismaticJoint_getMaxMotorForce(lua_State * L)
|
|
||||||
{
|
|
||||||
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
|
|
||||||
lua_pushnumber(L, t->getMaxMotorForce());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int w_PrismaticJoint_setMotorSpeed(lua_State * L)
|
int w_PrismaticJoint_setMotorSpeed(lua_State * L)
|
||||||
{
|
{
|
||||||
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
|
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
|
||||||
@@ -164,7 +157,6 @@ namespace box2d
|
|||||||
{ "setMotorEnabled", w_PrismaticJoint_setMotorEnabled },
|
{ "setMotorEnabled", w_PrismaticJoint_setMotorEnabled },
|
||||||
{ "isMotorEnabled", w_PrismaticJoint_isMotorEnabled },
|
{ "isMotorEnabled", w_PrismaticJoint_isMotorEnabled },
|
||||||
{ "setMaxMotorForce", w_PrismaticJoint_setMaxMotorForce },
|
{ "setMaxMotorForce", w_PrismaticJoint_setMaxMotorForce },
|
||||||
{ "getMaxMotorForce", w_PrismaticJoint_getMaxMotorForce },
|
|
||||||
{ "setMotorSpeed", w_PrismaticJoint_setMotorSpeed },
|
{ "setMotorSpeed", w_PrismaticJoint_setMotorSpeed },
|
||||||
{ "getMotorSpeed", w_PrismaticJoint_getMotorSpeed },
|
{ "getMotorSpeed", w_PrismaticJoint_getMotorSpeed },
|
||||||
{ "getMotorForce", w_PrismaticJoint_getMotorForce },
|
{ "getMotorForce", w_PrismaticJoint_getMotorForce },
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ namespace box2d
|
|||||||
int w_PrismaticJoint_setMotorEnabled(lua_State * L);
|
int w_PrismaticJoint_setMotorEnabled(lua_State * L);
|
||||||
int w_PrismaticJoint_isMotorEnabled(lua_State * L);
|
int w_PrismaticJoint_isMotorEnabled(lua_State * L);
|
||||||
int w_PrismaticJoint_setMaxMotorForce(lua_State * L);
|
int w_PrismaticJoint_setMaxMotorForce(lua_State * L);
|
||||||
int w_PrismaticJoint_getMaxMotorForce(lua_State * L);
|
|
||||||
int w_PrismaticJoint_setMotorSpeed(lua_State * L);
|
int w_PrismaticJoint_setMotorSpeed(lua_State * L);
|
||||||
int w_PrismaticJoint_getMotorSpeed(lua_State * L);
|
int w_PrismaticJoint_getMotorSpeed(lua_State * L);
|
||||||
int w_PrismaticJoint_getMotorForce(lua_State * L);
|
int w_PrismaticJoint_getMotorForce(lua_State * L);
|
||||||
|
|||||||
@@ -38,37 +38,6 @@ namespace box2d
|
|||||||
return t->getGroundAnchors(L);
|
return t->getGroundAnchors(L);
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_PulleyJoint_setMaxLengths(lua_State * L)
|
|
||||||
{
|
|
||||||
PulleyJoint * t = luax_checkpulleyjoint(L, 1);
|
|
||||||
float arg1 = (float)luaL_optnumber(L, 2, 0.0);
|
|
||||||
float arg2 = (float)luaL_optnumber(L, 3, 0.0);
|
|
||||||
t->setMaxLengths(arg1, arg2);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int w_PulleyJoint_getMaxLengths(lua_State * L)
|
|
||||||
{
|
|
||||||
PulleyJoint * t = luax_checkpulleyjoint(L, 1);
|
|
||||||
lua_remove(L, 1);
|
|
||||||
return t->getMaxLengths(L);
|
|
||||||
}
|
|
||||||
|
|
||||||
int w_PulleyJoint_setConstant(lua_State * L)
|
|
||||||
{
|
|
||||||
PulleyJoint * t = luax_checkpulleyjoint(L, 1);
|
|
||||||
float arg1 = (float)luaL_checknumber(L, 2);
|
|
||||||
t->setConstant(arg1);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int w_PulleyJoint_getConstant(lua_State * L)
|
|
||||||
{
|
|
||||||
PulleyJoint * t = luax_checkpulleyjoint(L, 1);
|
|
||||||
lua_pushnumber(L, t->getConstant());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int w_PulleyJoint_getLength1(lua_State * L)
|
int w_PulleyJoint_getLength1(lua_State * L)
|
||||||
{
|
{
|
||||||
PulleyJoint * t = luax_checkpulleyjoint(L, 1);
|
PulleyJoint * t = luax_checkpulleyjoint(L, 1);
|
||||||
@@ -83,14 +52,6 @@ namespace box2d
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_PulleyJoint_setRatio(lua_State * L)
|
|
||||||
{
|
|
||||||
PulleyJoint * t = luax_checkpulleyjoint(L, 1);
|
|
||||||
float arg1 = (float)luaL_checknumber(L, 2);
|
|
||||||
t->setRatio(arg1);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int w_PulleyJoint_getRatio(lua_State * L)
|
int w_PulleyJoint_getRatio(lua_State * L)
|
||||||
{
|
{
|
||||||
PulleyJoint * t = luax_checkpulleyjoint(L, 1);
|
PulleyJoint * t = luax_checkpulleyjoint(L, 1);
|
||||||
@@ -100,13 +61,8 @@ namespace box2d
|
|||||||
|
|
||||||
static const luaL_Reg functions[] = {
|
static const luaL_Reg functions[] = {
|
||||||
{ "getGroundAnchors", w_PulleyJoint_getGroundAnchors },
|
{ "getGroundAnchors", w_PulleyJoint_getGroundAnchors },
|
||||||
{ "setMaxLengths", w_PulleyJoint_setMaxLengths },
|
|
||||||
{ "getMaxLengths", w_PulleyJoint_getMaxLengths },
|
|
||||||
{ "setConstant", w_PulleyJoint_setConstant },
|
|
||||||
{ "getConstant", w_PulleyJoint_getConstant },
|
|
||||||
{ "getLength1", w_PulleyJoint_getLength1 },
|
{ "getLength1", w_PulleyJoint_getLength1 },
|
||||||
{ "getLength2", w_PulleyJoint_getLength2 },
|
{ "getLength2", w_PulleyJoint_getLength2 },
|
||||||
{ "setRatio", w_PulleyJoint_setRatio },
|
|
||||||
{ "getRatio", w_PulleyJoint_getRatio },
|
{ "getRatio", w_PulleyJoint_getRatio },
|
||||||
// From Joint.
|
// From Joint.
|
||||||
{ "getType", w_Joint_getType },
|
{ "getType", w_Joint_getType },
|
||||||
|
|||||||
@@ -34,13 +34,8 @@ namespace box2d
|
|||||||
{
|
{
|
||||||
PulleyJoint * luax_checkpulleyjoint(lua_State * L, int idx);
|
PulleyJoint * luax_checkpulleyjoint(lua_State * L, int idx);
|
||||||
int w_PulleyJoint_getGroundAnchors(lua_State * L);
|
int w_PulleyJoint_getGroundAnchors(lua_State * L);
|
||||||
int w_PulleyJoint_setMaxLengths(lua_State * L);
|
|
||||||
int w_PulleyJoint_getMaxLengths(lua_State * L);
|
|
||||||
int w_PulleyJoint_setConstant(lua_State * L);
|
|
||||||
int w_PulleyJoint_getConstant(lua_State * L);
|
|
||||||
int w_PulleyJoint_getLength1(lua_State * L);
|
int w_PulleyJoint_getLength1(lua_State * L);
|
||||||
int w_PulleyJoint_getLength2(lua_State * L);
|
int w_PulleyJoint_getLength2(lua_State * L);
|
||||||
int w_PulleyJoint_setRatio(lua_State * L);
|
|
||||||
int w_PulleyJoint_getRatio(lua_State * L);
|
int w_PulleyJoint_getRatio(lua_State * L);
|
||||||
int luaopen_pulleyjoint(lua_State * L);
|
int luaopen_pulleyjoint(lua_State * L);
|
||||||
|
|
||||||
|
|||||||
@@ -68,13 +68,6 @@ namespace box2d
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_RevoluteJoint_getMaxMotorTorque(lua_State * L)
|
|
||||||
{
|
|
||||||
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
|
|
||||||
lua_pushnumber(L, t->getMaxMotorTorque());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int w_RevoluteJoint_setMotorSpeed(lua_State * L)
|
int w_RevoluteJoint_setMotorSpeed(lua_State * L)
|
||||||
{
|
{
|
||||||
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
|
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
|
||||||
@@ -164,7 +157,6 @@ namespace box2d
|
|||||||
{ "setMotorEnabled", w_RevoluteJoint_setMotorEnabled },
|
{ "setMotorEnabled", w_RevoluteJoint_setMotorEnabled },
|
||||||
{ "isMotorEnabled", w_RevoluteJoint_isMotorEnabled },
|
{ "isMotorEnabled", w_RevoluteJoint_isMotorEnabled },
|
||||||
{ "setMaxMotorTorque", w_RevoluteJoint_setMaxMotorTorque },
|
{ "setMaxMotorTorque", w_RevoluteJoint_setMaxMotorTorque },
|
||||||
{ "getMaxMotorTorque", w_RevoluteJoint_getMaxMotorTorque },
|
|
||||||
{ "setMotorSpeed", w_RevoluteJoint_setMotorSpeed },
|
{ "setMotorSpeed", w_RevoluteJoint_setMotorSpeed },
|
||||||
{ "getMotorSpeed", w_RevoluteJoint_getMotorSpeed },
|
{ "getMotorSpeed", w_RevoluteJoint_getMotorSpeed },
|
||||||
{ "getMotorTorque", w_RevoluteJoint_getMotorTorque },
|
{ "getMotorTorque", w_RevoluteJoint_getMotorTorque },
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ namespace box2d
|
|||||||
int w_RevoluteJoint_setMotorEnabled(lua_State * L);
|
int w_RevoluteJoint_setMotorEnabled(lua_State * L);
|
||||||
int w_RevoluteJoint_isMotorEnabled(lua_State * L);
|
int w_RevoluteJoint_isMotorEnabled(lua_State * L);
|
||||||
int w_RevoluteJoint_setMaxMotorTorque(lua_State * L);
|
int w_RevoluteJoint_setMaxMotorTorque(lua_State * L);
|
||||||
int w_RevoluteJoint_getMaxMotorTorque(lua_State * L);
|
|
||||||
int w_RevoluteJoint_setMotorSpeed(lua_State * L);
|
int w_RevoluteJoint_setMotorSpeed(lua_State * L);
|
||||||
int w_RevoluteJoint_getMotorSpeed(lua_State * L);
|
int w_RevoluteJoint_getMotorSpeed(lua_State * L);
|
||||||
int w_RevoluteJoint_getMotorTorque(lua_State * L);
|
int w_RevoluteJoint_getMotorTorque(lua_State * L);
|
||||||
|
|||||||
Reference in New Issue
Block a user