|
@@ -46,8 +46,7 @@ void ManifoldReductionTest::Initialize()
|
|
|
Ref<ShapeSettings> mesh_shape = new MeshShapeSettings(triangles, std::move(materials));
|
|
|
|
|
|
// Floor
|
|
|
- Body &floor = *mBodyInterface->CreateBody(BodyCreationSettings(new ScaledShapeSettings(mesh_shape, Vec3::sReplicate(20)), RVec3::sZero(), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING));
|
|
|
- mBodyInterface->AddBody(floor.GetID(), EActivation::DontActivate);
|
|
|
+ mBodyInterface->CreateAndAddBody(BodyCreationSettings(new ScaledShapeSettings(mesh_shape, Vec3::sReplicate(20)), RVec3::sZero(), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING), EActivation::DontActivate);
|
|
|
|
|
|
// Create a box made of meshes
|
|
|
Ref<StaticCompoundShapeSettings> mesh_box_shape = new StaticCompoundShapeSettings;
|
|
@@ -75,16 +74,13 @@ void ManifoldReductionTest::Initialize()
|
|
|
three_box_shape->AddShape(Vec3(0, -1.1f, 0), Quat::sIdentity(), box_shape);
|
|
|
three_box_shape->AddShape(Vec3(2.1f, 0, 0), Quat::sIdentity(), box_shape);
|
|
|
|
|
|
-
|
|
|
// A set of 3 mesh boxes to rest on
|
|
|
- Body &three_mesh_box = *mBodyInterface->CreateBody(BodyCreationSettings(three_mesh_box_shape, RVec3(0, 1, 0), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING));
|
|
|
- mBodyInterface->AddBody(three_mesh_box.GetID(), EActivation::DontActivate);
|
|
|
+ mBodyInterface->CreateAndAddBody(BodyCreationSettings(three_mesh_box_shape, RVec3(0, 1, 0), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING), EActivation::DontActivate);
|
|
|
|
|
|
// A set of 3 boxes that are dynamic where the middle one penetrates more than the other two
|
|
|
BodyCreationSettings box_settings(three_box_shape, RVec3(0, 2.95f, 0), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING);
|
|
|
box_settings.mAllowSleeping = false;
|
|
|
- Body &box = *mBodyInterface->CreateBody(box_settings);
|
|
|
- mBodyInterface->AddBody(box.GetID(), EActivation::Activate);
|
|
|
+ mBodyInterface->CreateAndAddBody(box_settings, EActivation::Activate);
|
|
|
}
|
|
|
|
|
|
{
|
|
@@ -100,14 +96,12 @@ void ManifoldReductionTest::Initialize()
|
|
|
|
|
|
|
|
|
// A set of 2 mesh boxes to rest on
|
|
|
- Body &two_mesh_box = *mBodyInterface->CreateBody(BodyCreationSettings(two_mesh_box_shape, RVec3(0, 1, 4), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING));
|
|
|
- mBodyInterface->AddBody(two_mesh_box.GetID(), EActivation::DontActivate);
|
|
|
+ mBodyInterface->CreateAndAddBody(BodyCreationSettings(two_mesh_box_shape, RVec3(0, 1, 4), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING), EActivation::DontActivate);
|
|
|
|
|
|
// A set of 2 boxes that are dynamic, one is lower than the other
|
|
|
BodyCreationSettings box_settings(two_box_shape, RVec3(0, 4, 4), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING);
|
|
|
box_settings.mAllowSleeping = false;
|
|
|
- Body &box = *mBodyInterface->CreateBody(box_settings);
|
|
|
- mBodyInterface->AddBody(box.GetID(), EActivation::Activate);
|
|
|
+ mBodyInterface->CreateAndAddBody(box_settings, EActivation::Activate);
|
|
|
}
|
|
|
|
|
|
{
|
|
@@ -117,14 +111,12 @@ void ManifoldReductionTest::Initialize()
|
|
|
two_mesh_shape->AddShape(Vec3(-1, 0, 0), Quat::sRotation(Vec3::sAxisZ(), DegreesToRadians(-2)), mesh_shape);
|
|
|
|
|
|
// A set of 2 meshes to rest on
|
|
|
- Body &two_mesh_box = *mBodyInterface->CreateBody(BodyCreationSettings(two_mesh_shape, RVec3(0, 1, -4), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING));
|
|
|
- mBodyInterface->AddBody(two_mesh_box.GetID(), EActivation::DontActivate);
|
|
|
+ mBodyInterface->CreateAndAddBody(BodyCreationSettings(two_mesh_shape, RVec3(0, 1, -4), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING), EActivation::DontActivate);
|
|
|
|
|
|
// A box that is dynamic, resting on the slightly sloped surface. The surface normals are close enough so that the manifold should be merged.
|
|
|
BodyCreationSettings box_settings(box_shape, RVec3(0, 4, -4), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING);
|
|
|
box_settings.mAllowSleeping = false;
|
|
|
- Body &box = *mBodyInterface->CreateBody(box_settings);
|
|
|
- mBodyInterface->AddBody(box.GetID(), EActivation::Activate);
|
|
|
+ mBodyInterface->CreateAndAddBody(box_settings, EActivation::Activate);
|
|
|
}
|
|
|
|
|
|
{
|
|
@@ -134,13 +126,11 @@ void ManifoldReductionTest::Initialize()
|
|
|
two_mesh_shape->AddShape(Vec3(-1, 0, 0), Quat::sRotation(Vec3::sAxisZ(), DegreesToRadians(-3)), mesh_shape);
|
|
|
|
|
|
// A set of 2 meshes to rest on
|
|
|
- Body &two_mesh_box = *mBodyInterface->CreateBody(BodyCreationSettings(two_mesh_shape, RVec3(0, 1, -8), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING));
|
|
|
- mBodyInterface->AddBody(two_mesh_box.GetID(), EActivation::DontActivate);
|
|
|
+ mBodyInterface->CreateAndAddBody(BodyCreationSettings(two_mesh_shape, RVec3(0, 1, -8), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING), EActivation::DontActivate);
|
|
|
|
|
|
// A box that is dynamic, resting on the slightly sloped surface. The surface normals are not close enough so that the manifold should be merged.
|
|
|
BodyCreationSettings box_settings(box_shape, RVec3(0, 4, -8), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING);
|
|
|
box_settings.mAllowSleeping = false;
|
|
|
- Body &box = *mBodyInterface->CreateBody(box_settings);
|
|
|
- mBodyInterface->AddBody(box.GetID(), EActivation::Activate);
|
|
|
+ mBodyInterface->CreateAndAddBody(box_settings, EActivation::Activate);
|
|
|
}
|
|
|
}
|