fix a lot of issues, add gyroscopic force integrator, add contact polygon winding, add some quaternion constraints, add more tests
This commit is contained in:
@ -24,56 +24,33 @@ class AngularMotion : public Test
|
||||
public:
|
||||
AngularMotion()
|
||||
{
|
||||
b3BodyDef bdef;
|
||||
bdef.type = e_dynamicBody;
|
||||
bdef.position.Set(0.0f, 0.0f, 0.0f);
|
||||
b3BodyDef bd;
|
||||
b3Body* ground = m_world.CreateBody(bd);
|
||||
|
||||
m_body = m_world.CreateBody(bdef);
|
||||
bd.type = e_dynamicBody;
|
||||
bd.angularVelocity.Set(0.0f, B3_PI, 0.0f);
|
||||
b3Body* body = m_world.CreateBody(bd);
|
||||
|
||||
b3CapsuleShape shape;
|
||||
shape.m_centers[0].Set(0.0f, 1.0f, 0.0f);
|
||||
shape.m_centers[1].Set(0.0f, -1.0f, 0.0f);
|
||||
shape.m_centers[0].Set(0.0f, 0.0f, -1.0f);
|
||||
shape.m_centers[1].Set(0.0f, 0.0f, 1.0f);
|
||||
shape.m_radius = 1.0f;
|
||||
|
||||
b3ShapeDef sdef;
|
||||
sdef.shape = &shape;
|
||||
sdef.density = 1.0f;
|
||||
|
||||
m_body->CreateShape(sdef);
|
||||
|
||||
b3MassData data;
|
||||
m_body->GetMassData(&data);
|
||||
|
||||
m_body->SetMassData(&data);
|
||||
|
||||
b3Vec3 g(0.0f, 0.0f, 0.0f);
|
||||
m_world.SetGravity(g);
|
||||
}
|
||||
|
||||
void Step()
|
||||
{
|
||||
Test::Step();
|
||||
|
||||
b3Vec3 v(0.0f, 0.0f, 0.0f);
|
||||
m_body->SetLinearVelocity(v);
|
||||
|
||||
b3Vec3 p = m_body->GetSweep().worldCenter;
|
||||
b3Quat quat = m_body->GetSweep().orientation;
|
||||
|
||||
b3Vec3 axis;
|
||||
float32 angle;
|
||||
quat.GetAxisAngle(&axis, &angle);
|
||||
body->CreateShape(sdef);
|
||||
|
||||
b3Vec3 q(0.0f, 0.0f, 0.0f);
|
||||
m_body->SetTransform(q, axis, angle);
|
||||
b3SphereJointDef jd;
|
||||
jd.Initialize(ground, body, b3Vec3(0.0f, 0.0f, 0.0f));
|
||||
m_world.CreateJoint(jd);
|
||||
}
|
||||
|
||||
static Test* Create()
|
||||
{
|
||||
return new AngularMotion();
|
||||
}
|
||||
|
||||
b3Body* m_body;
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user