コード例 #1
0
void physics_fixture_set_box_shape(int id, double halfwidth, double halfheight)
{
  get_fixture(sb2dfixture, id);
  b2PolygonShape shape;
  shape.SetAsBox(halfwidth, halfheight);
  sb2dfixture->shape = &shape;
  sb2dfixture->FinishShape();
}
コード例 #2
0
void physics_fixture_set_circle_shape(int id, double radius)
{
  get_fixture(sb2dfixture, id);
  b2CircleShape shape;
  shape.m_radius = radius;
  sb2dfixture->shape = &shape;
  sb2dfixture->FinishShape();
}
コード例 #3
0
void physics_fixture_set_collision_group(int id, int group)
{
  get_fixture(sb2dfixture, id);
  // sets the collision group used to make parts of things not collide, like a ragdoll for
  // instance should not collide with itself
  b2Filter newfilter;
  newfilter.groupIndex = group;
  fixtures[id]->fixture->SetFilterData(newfilter);
}
コード例 #4
0
void physics_fixture_set_polygon_shape(int id)
{
  get_fixture(sb2dfixture, id);
  b2PolygonShape shape;

  shape.Set(&sb2dfixture->vertices[0], sb2dfixture->vertices.size());
  sb2dfixture->shape = &shape;
  sb2dfixture->FinishShape();
}
コード例 #5
0
void physics_fixture_mass_properties(int id, double mass, double local_center_x, double local_center_y, double inertia)
{
  get_fixture(sb2dfixture, id);
  b2MassData lMassData;
  sb2dfixture->body->GetMassData(&lMassData);
  lMassData.mass = mass;
  lMassData.center.Set(local_center_x, local_center_y);
  lMassData.I = inertia;
  sb2dfixture->body->SetMassData(&lMassData);
}
コード例 #6
0
void physics_apply_impulse(int world, double xpos, double ypos, double ximpulse, double yimpulse, bool wake)
{
  get_fixture(sb2dworld, world);
  for (int i = 0; i < fixtures.size(); i++)
  {
    if (fixtures[i]->world == world)
    {
      fixtures[i]->body->ApplyLinearImpulse(b2Vec2(ximpulse, yimpulse), b2Vec2(xpos, ypos), wake);
    }
  }
}
コード例 #7
0
void physics_apply_force(int world, double xpos, double ypos, double xforce, double yforce, bool wake)
{
  get_fixture(sb2dworld, world);
  for (int i = 0; i < fixtures.size(); i++)
  {
    if (fixtures[i]->world == world)
    {
      fixtures[i]->body->ApplyForce(b2Vec2(xforce, yforce), b2Vec2(xpos, ypos), wake);
    }
  }
}
コード例 #8
0
void physics_fixture_set_density(int id, double density)
{
  get_fixture(sb2dfixture, id);
  // stupido makes it so 0 density, means infinite density and just makes it
  // a static object, thats actually stupid though because box2d lets you use it as a flag
  // for floating object, oh well use the ENIGMA version instead :/
  if (density == 0) {
    sb2dfixture->body->SetType(b2_staticBody);
  } else {
    sb2dfixture->fixture->SetDensity(density);
    sb2dfixture->body->ResetMassData();
  }
}
コード例 #9
0
void physics_fixture_set_edge_shape(int id, bool adjstart, bool adjend) 
{
  get_fixture(sb2dfixture, id);
  b2EdgeShape shape;

  int vid = 0;
  if (adjstart) {
    shape.m_hasVertex0 = true;
    shape.m_vertex0 = sb2dfixture->vertices[vid];
    vid += 1;
  }
  shape.Set(sb2dfixture->vertices[vid],  sb2dfixture->vertices[vid + 1]);
  vid += 2;
  if (adjend) {
    shape.m_hasVertex3 = true;
    shape.m_vertex3 = sb2dfixture->vertices[vid];
  }
  sb2dfixture->shape = &shape;
  sb2dfixture->FinishShape();
}
コード例 #10
0
void physics_fixture_set_static(int id)
{
  get_fixture(sb2dfixture, id);
  sb2dfixture->body->SetType(b2_staticBody);
  sb2dfixture->body->ResetMassData();
}
コード例 #11
0
ファイル: B2Dshapes.cpp プロジェクト: DarkAceZ/enigma-dev
void b2d_fixture_set_restitution(int id, double restitution)
{
  get_fixture(b2dfixture, id);
  b2dfixture->fixture->SetRestitution(restitution);
}
コード例 #12
0
void physics_fixture_set_sleep(int id, bool allowsleep)
{
  get_fixture(sb2dfixture, id);
  sb2dfixture->body->SetSleepingAllowed(allowsleep);
}
コード例 #13
0
void physics_fixture_set_awake(int id, bool state)
{
  get_fixture(sb2dfixture, id);
  sb2dfixture->body->SetAwake(state);
}
コード例 #14
0
void physics_fixture_set_sensor(int id, bool state)
{
  get_fixture(sb2dfixture, id);
  sb2dfixture->fixture->SetSensor(state);
}
コード例 #15
0
void physics_fixture_set_restitution(int id, double restitution)
{
  get_fixture(sb2dfixture, id);
  sb2dfixture->fixture->SetRestitution(restitution);
}
コード例 #16
0
void physics_fixture_bind(int id)
{
  // binds a fixture to nothing, just closes and fills the definition
  get_fixture(sb2dfixture, id);
}
コード例 #17
0
void physics_fixture_set_friction(int id, double friction)
{
  get_fixture(sb2dfixture, id);
  sb2dfixture->fixture->SetFriction(friction);
  sb2dfixture->body->ResetMassData();
}
コード例 #18
0
ファイル: B2Dshapes.cpp プロジェクト: DarkAceZ/enigma-dev
void b2d_fixture_set_friction(int id, double friction)
{
  get_fixture(b2dfixture, id);
  b2dfixture->fixture->SetFriction(friction);
}
コード例 #19
0
void physics_apply_local_impulse(int id, double xlocal, double ylocal, double ximpulse, double yimpulse, bool wake)
{
  get_fixture(sb2dfixture, id);
  sb2dfixture->body->ApplyLinearImpulse(b2Vec2(ximpulse, yimpulse), b2Vec2(xlocal, ylocal), wake);
}
コード例 #20
0
ファイル: B2Dshapes.cpp プロジェクト: DarkAceZ/enigma-dev
void b2d_fixture_set_sensor(int id, bool state)
{
  get_fixture(b2dfixture, id);
  b2dfixture->fixture->SetSensor(state);
}
コード例 #21
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_angle_to_radians(angle));
}
コード例 #22
0
void physics_fixture_add_point(int id, double x, double y)
{
  get_fixture(sb2dfixture, id);
  sb2dfixture->vertices.push_back(b2Vec2(x, y));
}
コード例 #23
0
void physics_fixture_set_dynamic(int id)
{
  get_fixture(sb2dfixture, id);
  sb2dfixture->body->SetType(b2_dynamicBody);
}
コード例 #24
0
void physics_fixture_set_angular_damping(int id, double damping)
{
  get_fixture(sb2dfixture, id);
  sb2dfixture->body->SetAngularDamping(damping);
}
コード例 #25
0
void physics_fixture_set_position(int id, double x, double y)
{
  get_fixture(sb2dfixture, id);
  sb2dfixture->body->SetTransform(b2Vec2(x, y), sb2dfixture->body->GetAngle());
}
コード例 #26
0
void physics_fixture_delete(int id)
{
  get_fixture(sb2dfixture, id);
  delete sb2dfixture;
}
コード例 #27
0
void physics_apply_local_force(int id, double xlocal, double ylocal, double xforce, double yforce, bool wake)
{
  get_fixture(sb2dfixture, id);
  sb2dfixture->body->ApplyForce(b2Vec2(xforce, yforce), b2Vec2(xlocal, ylocal), wake);
}
コード例 #28
0
void physics_fixture_set_angle(int id, double angle)
{
  get_fixture(sb2dfixture, id);
  sb2dfixture->body->SetTransform(sb2dfixture->body->GetPosition(), cs_angle_to_radians(angle));
}
コード例 #29
0
void physics_apply_local_torque(int id, double torque, bool wake)
{
  get_fixture(sb2dfixture, id);
  sb2dfixture->body->ApplyTorque(torque, wake);
}
コード例 #30
0
ファイル: B2Dshapes.cpp プロジェクト: DarkAceZ/enigma-dev
void b2d_fixture_set_density(int id, double density)
{
  get_fixture(b2dfixture, id);
  b2dfixture->fixture->SetDensity(density);
}