mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-08 13:14:33 +00:00
initial commit jolt
This commit is contained in:
parent
0c2aa5328c
commit
8acf7da95b
1086 changed files with 214612 additions and 4 deletions
|
|
@ -0,0 +1,40 @@
|
|||
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
|
||||
// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#include <TestFramework.h>
|
||||
|
||||
#include <Tests/ScaledShapes/ScaledSphereShapeTest.h>
|
||||
#include <Jolt/Physics/Collision/Shape/SphereShape.h>
|
||||
#include <Jolt/Physics/Collision/Shape/ScaledShape.h>
|
||||
#include <Jolt/Physics/Body/BodyCreationSettings.h>
|
||||
#include <Layers.h>
|
||||
|
||||
JPH_IMPLEMENT_RTTI_VIRTUAL(ScaledSphereShapeTest)
|
||||
{
|
||||
JPH_ADD_BASE_CLASS(ScaledSphereShapeTest, Test)
|
||||
}
|
||||
|
||||
void ScaledSphereShapeTest::Initialize()
|
||||
{
|
||||
// Floor
|
||||
CreateFloor();
|
||||
|
||||
// Create sphere
|
||||
RefConst<SphereShape> sphere_shape = new SphereShape(2.0f);
|
||||
|
||||
// Original shape
|
||||
mBodyInterface->CreateAndAddBody(BodyCreationSettings(sphere_shape, RVec3(-20, 10, 0), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING), EActivation::Activate);
|
||||
|
||||
// Uniformly scaled shape < 1
|
||||
mBodyInterface->CreateAndAddBody(BodyCreationSettings(new ScaledShape(sphere_shape, Vec3::sReplicate(0.25f)), RVec3(-10, 10, 0), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING), EActivation::Activate);
|
||||
|
||||
// Uniformly scaled shape > 1
|
||||
mBodyInterface->CreateAndAddBody(BodyCreationSettings(new ScaledShape(sphere_shape, Vec3::sReplicate(2.0f)), RVec3(0, 10, 0), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING), EActivation::Activate);
|
||||
|
||||
// Flipped in 2 axis
|
||||
mBodyInterface->CreateAndAddBody(BodyCreationSettings(new ScaledShape(sphere_shape, Vec3(-0.25f, 0.25f, -0.25f)), RVec3(10, 10, 0), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING), EActivation::Activate);
|
||||
|
||||
// Inside out
|
||||
mBodyInterface->CreateAndAddBody(BodyCreationSettings(new ScaledShape(sphere_shape, Vec3::sReplicate(-0.25f)), RVec3(20, 10, 0), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING), EActivation::Activate);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue