parent
aaa795e34f
commit
e9f6f1d0aa
7 changed files with 249 additions and 30 deletions
|
|
@ -369,10 +369,11 @@ public:
|
|||
|
||||
static int sampleGyroscopicTorque = RegisterSample( "Bodies", "Gyroscopic Torque", GyroscopicTorque::Create );
|
||||
|
||||
// todo this doesn't behave correctly because the friction center is influenced by speculative points
|
||||
// Spinning tops. Ported from PEEL.
|
||||
// Each top is tilted and spun about the world up axis. Offsetting the spin axis from the
|
||||
// symmetry axis is what makes them precess under gravity instead of spinning true.
|
||||
// todo disabling this until issue #65 is fixed
|
||||
#if 0
|
||||
// Spinning tops.
|
||||
// Ported from PEEL (GyroscopicPrecession).
|
||||
class GyroscopicPrecession : public Sample
|
||||
{
|
||||
public:
|
||||
|
|
@ -381,10 +382,10 @@ public:
|
|||
{
|
||||
if ( context->restart == false )
|
||||
{
|
||||
m_camera->SetView( 0.0f, 25.0f, 55.0f, { 0.0f, 2.0f, 0.0f } );
|
||||
m_camera->SetView( 40.0f, 30.0f, 75.0f, { 0.0f, 2.0f, 0.0f } );
|
||||
}
|
||||
|
||||
AddGroundBox( 30.0f );
|
||||
AddGroundBox( 40.0f );
|
||||
|
||||
// Top shape: a wide n-gon rim up top and a point at the origin, so it balances on its tip.
|
||||
constexpr int numSegs = 7;
|
||||
|
|
@ -401,11 +402,11 @@ public:
|
|||
|
||||
b3ShapeDef shapeDef = b3DefaultShapeDef();
|
||||
|
||||
// Tilt the symmetry axis, then spin about that tilted axis so gravity induces precession.
|
||||
// Tilt the symmetry axis, then spin about the world up axis so the offset drives precession.
|
||||
b3Quat rotation = b3MakeQuatFromAxisAngle( b3Vec3_axisZ, 15.0f * B3_PI / 180.0f );
|
||||
b3Vec3 angularVelocity = b3RotateVector( rotation, { 0.0f, 75.0f, 0.0f } );
|
||||
|
||||
constexpr int count = 1;
|
||||
constexpr int count = 8;
|
||||
constexpr float separation = 6.0f;
|
||||
for ( int x = 0; x < count; ++x )
|
||||
{
|
||||
|
|
@ -415,7 +416,6 @@ public:
|
|||
bodyDef.type = b3_dynamicBody;
|
||||
bodyDef.position = { ( x - count / 2 ) * separation, h, ( z - count / 2 ) * separation };
|
||||
bodyDef.rotation = rotation;
|
||||
bodyDef.gravityScale = 0.0f;
|
||||
|
||||
// The spin rate exceeds the default cap, so bypass it as the test intends.
|
||||
bodyDef.allowFastRotation = true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue