BigVsSmallTest.cpp 1.1 KB

123456789101112131415161718192021222324252627282930
  1. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  2. // SPDX-License-Identifier: MIT
  3. #include <TestFramework.h>
  4. #include <Tests/General/BigVsSmallTest.h>
  5. #include <Jolt/Physics/Collision/Shape/BoxShape.h>
  6. #include <Jolt/Physics/Collision/Shape/MeshShape.h>
  7. #include <Jolt/Physics/Body/BodyCreationSettings.h>
  8. #include <Jolt/Geometry/Triangle.h>
  9. #include <Layers.h>
  10. JPH_IMPLEMENT_RTTI_VIRTUAL(BigVsSmallTest)
  11. {
  12. JPH_ADD_BASE_CLASS(BigVsSmallTest, Test)
  13. }
  14. void BigVsSmallTest::Initialize()
  15. {
  16. // Create a big triangle
  17. TriangleList triangles;
  18. triangles.push_back(Triangle(Float3(-100, 0, 0), Float3(0, 0, 100), Float3(100, 0, -100)));
  19. Body &triangle = *mBodyInterface->CreateBody(BodyCreationSettings(new MeshShapeSettings(triangles), Vec3::sZero(), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING));
  20. mBodyInterface->AddBody(triangle.GetID(), EActivation::DontActivate);
  21. // A small box
  22. Body &body = *mBodyInterface->CreateBody(BodyCreationSettings(new BoxShape(Vec3(0.1f, 0.1f, 0.1f)), Vec3(0, 1.0f, 0), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING));
  23. body.SetAllowSleeping(false);
  24. mBodyInterface->AddBody(body.GetID(), EActivation::Activate);
  25. }