Beispiel #1
0
int b2d_joint_create_revolute(int world, int bodya, int bodyb, bool limit, double lower, double upper)
{
    get_worldr(b2dworld, world, -1);
    get_bodyr(b2dbodya, bodya, -1);
    get_bodyr(b2dbodyb, bodyb, -1);
    b2RevoluteJointDef jointDef;
    jointDef.bodyA = b2dbodya->body;
    jointDef.bodyB = b2dbodyb->body;
    jointDef.lowerAngle = cs_angular_degrees(lower);
    jointDef.upperAngle = cs_angular_degrees(upper);
    jointDef.localAnchorA = b2Vec2(0,0);
    jointDef.localAnchorB =b2Vec2(1,1);
    jointDef.enableLimit = limit;
    B2DJoint* b2djoint = new B2DJoint();
    b2djoint->joint = b2dworld->world->CreateJoint(&jointDef);
    b2djoint->worldid = world;
    b2djoints.push_back(b2djoint);
    return b2djoints.size() - 1;
}
Beispiel #2
0
void physics_fixture_set_angle(int id, double angle)
{
    get_fixture(sb2dfixture, id);
    sb2dfixture->body->SetTransform(sb2dfixture->body->GetPosition(), cs_angular_degrees(angle));
}
Beispiel #3
0
void physics_fixture_set_transform(int id, double x, double y, double angle)
{
    get_fixture(sb2dfixture, id);
    sb2dfixture->body->SetTransform(b2Vec2(x, y), cs_angular_degrees(angle));
}