|
@@ -18,19 +18,15 @@ void CylinderShapeTest::Initialize()
|
|
|
// Floor
|
|
|
CreateFloor();
|
|
|
|
|
|
- RefConst<Shape> big_cylinder = new CylinderShape(2.5f, 2);
|
|
|
-
|
|
|
// Cylinder on flat part
|
|
|
- Body &body1 = *mBodyInterface->CreateBody(BodyCreationSettings(big_cylinder, Vec3(0, 10, 0), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING));
|
|
|
- mBodyInterface->AddBody(body1.GetID(), EActivation::Activate);
|
|
|
-
|
|
|
+ RefConst<Shape> big_cylinder = new CylinderShape(2.5f, 2);
|
|
|
+ mBodyInterface->CreateAndAddBody(BodyCreationSettings(big_cylinder, Vec3(0, 10, 0), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING), EActivation::Activate);
|
|
|
+
|
|
|
// Cylinder on round part
|
|
|
- Body &body2 = *mBodyInterface->CreateBody(BodyCreationSettings(big_cylinder, Vec3(10, 10, 0), Quat::sRotation(Vec3::sAxisX(), 0.5f * JPH_PI), EMotionType::Dynamic, Layers::MOVING));
|
|
|
- mBodyInterface->AddBody(body2.GetID(), EActivation::Activate);
|
|
|
-
|
|
|
- RefConst<Shape> long_cylinder = new CylinderShape(5, 1);
|
|
|
+ mBodyInterface->CreateAndAddBody(BodyCreationSettings(big_cylinder, Vec3(10, 10, 0), Quat::sRotation(Vec3::sAxisX(), 0.5f * JPH_PI), EMotionType::Dynamic, Layers::MOVING), EActivation::Activate);
|
|
|
|
|
|
// Tower of cylinders
|
|
|
+ RefConst<Shape> long_cylinder = new CylinderShape(5, 1);
|
|
|
for (int i = 0; i < 10; ++i)
|
|
|
{
|
|
|
for (int j = 0; j < 2; ++j)
|
|
@@ -47,8 +43,12 @@ void CylinderShapeTest::Initialize()
|
|
|
position = Vec3(0, 2.0f + 3.0f * i, -20.0f - 4.0f + 8.0f * j);
|
|
|
rotation = Quat::sRotation(Vec3::sAxisZ(), 0.5f * JPH_PI);
|
|
|
}
|
|
|
- Body &body = *mBodyInterface->CreateBody(BodyCreationSettings(long_cylinder, position, rotation, EMotionType::Dynamic, Layers::MOVING));
|
|
|
- mBodyInterface->AddBody(body.GetID(), EActivation::Activate);
|
|
|
+ mBodyInterface->CreateAndAddBody(BodyCreationSettings(long_cylinder, position, rotation, EMotionType::Dynamic, Layers::MOVING), EActivation::Activate);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // Tower of thin cylinders
|
|
|
+ RefConst<Shape> thin_cylinder = new CylinderShape(0.1f, 5.0f);
|
|
|
+ for (int i = 0; i < 10; ++i)
|
|
|
+ mBodyInterface->CreateAndAddBody(BodyCreationSettings(thin_cylinder, Vec3(20.0f, 10.0f - 1.0f * i, 0), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING), EActivation::Activate);
|
|
|
}
|