Ajout de Jolt Physics + 1ere version des factory entitecomposants - camera, transform, rigidbody, collider, renderer
This commit is contained in:
43
lib/All/JoltPhysics/Samples/Tests/General/SimpleTest.cpp
Normal file
43
lib/All/JoltPhysics/Samples/Tests/General/SimpleTest.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
|
||||
// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#include <TestFramework.h>
|
||||
|
||||
#include <Tests/General/SimpleTest.h>
|
||||
#include <Jolt/Physics/Collision/Shape/BoxShape.h>
|
||||
#include <Jolt/Physics/Collision/Shape/SphereShape.h>
|
||||
#include <Jolt/Physics/Body/BodyCreationSettings.h>
|
||||
#include <Jolt/Physics/Body/BodyActivationListener.h>
|
||||
#include <Layers.h>
|
||||
|
||||
JPH_IMPLEMENT_RTTI_VIRTUAL(SimpleTest)
|
||||
{
|
||||
JPH_ADD_BASE_CLASS(SimpleTest, Test)
|
||||
}
|
||||
|
||||
SimpleTest::~SimpleTest()
|
||||
{
|
||||
// Unregister activation listener
|
||||
mPhysicsSystem->SetBodyActivationListener(nullptr);
|
||||
}
|
||||
|
||||
void SimpleTest::Initialize()
|
||||
{
|
||||
// Register activation listener
|
||||
mPhysicsSystem->SetBodyActivationListener(&mBodyActivationListener);
|
||||
|
||||
// Floor
|
||||
CreateFloor();
|
||||
|
||||
RefConst<Shape> box_shape = new BoxShape(Vec3(0.5f, 1.0f, 2.0f));
|
||||
|
||||
// Dynamic body 1
|
||||
mBodyInterface->CreateAndAddBody(BodyCreationSettings(box_shape, RVec3(0, 10, 0), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING), EActivation::Activate);
|
||||
|
||||
// Dynamic body 2
|
||||
mBodyInterface->CreateAndAddBody(BodyCreationSettings(box_shape, RVec3(5, 10, 0), Quat::sRotation(Vec3::sAxisX(), 0.25f * JPH_PI), EMotionType::Dynamic, Layers::MOVING), EActivation::Activate);
|
||||
|
||||
// Dynamic body 3
|
||||
mBodyInterface->CreateAndAddBody(BodyCreationSettings(new SphereShape(2.0f), RVec3(10, 10, 0), Quat::sRotation(Vec3::sAxisX(), 0.25f * JPH_PI), EMotionType::Dynamic, Layers::MOVING), EActivation::Activate);
|
||||
}
|
||||
Reference in New Issue
Block a user