JoltPhysics3D: Allow to construct components without using the system

This commit is contained in:
SirLynix
2023-07-23 13:05:33 +02:00
parent 20f000c8dc
commit c081811760
14 changed files with 167 additions and 87 deletions

View File

@@ -66,7 +66,11 @@ int main()
//auto& playerBody = playerEntity.emplace<Nz::JoltRigidBody3DComponent>(physSytem.CreateRigidBody(playerCollider));
//playerBody.SetMass(42.f);
character.emplace(physSytem.GetPhysWorld(), playerCollider, Nz::Vector3f::Up() * 5.f);
Nz::JoltCharacter::Settings characterSettings;
characterSettings.collider = playerCollider;
characterSettings.position = Nz::Vector3f::Up() * 5.f;
character.emplace(physSytem.GetPhysWorld(), characterSettings);
app.AddUpdaterFunc([&]
{
@@ -351,7 +355,7 @@ int main()
Nz::JoltRigidBody3D::StaticSettings floorSettings;
floorSettings.geom = translatedFloorCollider;
floorEntity.emplace<Nz::JoltRigidBody3DComponent>(physSytem.CreateRigidBody(floorSettings));
floorEntity.emplace<Nz::JoltRigidBody3DComponent>(floorSettings);
std::shared_ptr<Nz::GraphicalMesh> boxMeshGfx = Nz::GraphicalMesh::Build(Nz::Primitive::Box(Nz::Vector3f(0.5f, 0.5f, 0.5f)), meshPrimitiveParams);