initial commit jolt

This commit is contained in:
marauder2k7 2026-05-17 17:34:15 +01:00
parent 0c2aa5328c
commit 8acf7da95b
1086 changed files with 214612 additions and 4 deletions

View file

@ -0,0 +1,36 @@
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
// SPDX-License-Identifier: MIT
#include <TestFramework.h>
#include <Tests/General/HeavyOnLightTest.h>
#include <Jolt/Physics/Collision/Shape/BoxShape.h>
#include <Jolt/Physics/Body/BodyCreationSettings.h>
#include <Layers.h>
JPH_IMPLEMENT_RTTI_VIRTUAL(HeavyOnLightTest)
{
JPH_ADD_BASE_CLASS(HeavyOnLightTest, Test)
}
void HeavyOnLightTest::Initialize()
{
// Floor
CreateFloor();
Ref<BoxShape> box = new BoxShape(Vec3::sReplicate(5));
box->SetDensity(1000.0f);
for (int i = 1; i <= 10; ++i)
{
BodyID id = mBodyInterface->CreateAndAddBody(BodyCreationSettings(box, RVec3(-75.0f + i * 15.0f, 10.0f, 0.0f), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING), EActivation::Activate);
SetBodyLabel(id, StringFormat("Mass: %g", double(box->GetMassProperties().mMass)));
Ref<BoxShape> box2 = new BoxShape(Vec3::sReplicate(5));
box2->SetDensity(5000.0f * i);
id = mBodyInterface->CreateAndAddBody(BodyCreationSettings(box2, RVec3(-75.0f + i * 15.0f, 30.0f, 0.0f), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING), EActivation::Activate);
SetBodyLabel(id, StringFormat("Mass: %g", double(box2->GetMassProperties().mMass)));
}
}