Rename Physics3D to BulletPhysics3D
This commit is contained in:
committed by
Jérôme Leclercq
parent
5cbc435e1a
commit
bd4c2d6ee7
@@ -1,10 +1,10 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Physics3D/Collider3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletCollider3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletHelper.hpp>
|
||||
#include <Nazara/Core/PrimitiveList.hpp>
|
||||
#include <Nazara/Physics3D/BulletHelper.hpp>
|
||||
#include <Nazara/Utility/Algorithm.hpp>
|
||||
#include <Nazara/Utility/IndexBuffer.hpp>
|
||||
#include <Nazara/Utility/SoftwareBuffer.hpp>
|
||||
@@ -20,18 +20,18 @@
|
||||
#include <BulletCollision/CollisionShapes/btCylinderShape.h>
|
||||
#include <BulletCollision/CollisionShapes/btEmptyShape.h>
|
||||
#include <BulletCollision/CollisionShapes/btSphereShape.h>
|
||||
#include <Nazara/Physics3D/Debug.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
Collider3D::~Collider3D() = default;
|
||||
BulletCollider3D::~BulletCollider3D() = default;
|
||||
|
||||
Boxf Collider3D::ComputeAABB(const Vector3f& translation, const Quaternionf& rotation, const Vector3f& scale) const
|
||||
Boxf BulletCollider3D::ComputeAABB(const Vector3f& translation, const Quaternionf& rotation, const Vector3f& scale) const
|
||||
{
|
||||
return ComputeAABB(Matrix4f::Transform(translation, rotation), scale);
|
||||
}
|
||||
|
||||
Boxf Collider3D::ComputeAABB(const Matrix4f& offsetMatrix, const Vector3f& scale) const
|
||||
Boxf BulletCollider3D::ComputeAABB(const Matrix4f& offsetMatrix, const Vector3f& scale) const
|
||||
{
|
||||
btTransform transform = ToBullet(offsetMatrix);
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Nz
|
||||
return Boxf(scale * FromBullet(min), scale * FromBullet(max));
|
||||
}
|
||||
|
||||
void Collider3D::ComputeInertia(float mass, Vector3f* inertia) const
|
||||
void BulletCollider3D::ComputeInertia(float mass, Vector3f* inertia) const
|
||||
{
|
||||
NazaraAssert(inertia, "invalid inertia pointer");
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Nz
|
||||
*inertia = FromBullet(inertiaVec);
|
||||
}
|
||||
|
||||
std::shared_ptr<StaticMesh> Collider3D::GenerateDebugMesh() const
|
||||
std::shared_ptr<StaticMesh> BulletCollider3D::GenerateDebugMesh() const
|
||||
{
|
||||
std::vector<Vector3f> colliderVertices;
|
||||
std::vector<UInt16> colliderIndices;
|
||||
@@ -67,7 +67,7 @@ namespace Nz
|
||||
return colliderSubMesh;
|
||||
}
|
||||
|
||||
std::shared_ptr<Collider3D> Collider3D::Build(const PrimitiveList& list)
|
||||
std::shared_ptr<BulletCollider3D> BulletCollider3D::Build(const PrimitiveList& list)
|
||||
{
|
||||
std::size_t primitiveCount = list.GetSize();
|
||||
if (primitiveCount > 1)
|
||||
@@ -89,7 +89,7 @@ namespace Nz
|
||||
return std::make_shared<NullCollider3D>();
|
||||
}
|
||||
|
||||
std::shared_ptr<Collider3D> Collider3D::CreateGeomFromPrimitive(const Primitive& primitive)
|
||||
std::shared_ptr<BulletCollider3D> BulletCollider3D::CreateGeomFromPrimitive(const Primitive& primitive)
|
||||
{
|
||||
switch (primitive.type)
|
||||
{
|
||||
@@ -108,7 +108,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
NazaraError("Primitive type not handled (0x" + NumberToString(UnderlyingCast(primitive.type), 16) + ')');
|
||||
return std::shared_ptr<Collider3D>();
|
||||
return std::shared_ptr<BulletCollider3D>();
|
||||
}
|
||||
|
||||
/********************************** BoxCollider3D **********************************/
|
||||
123
src/Nazara/BulletPhysics3D/BulletConstraint3D.cpp
Normal file
123
src/Nazara/BulletPhysics3D/BulletConstraint3D.cpp
Normal file
@@ -0,0 +1,123 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/BulletPhysics3D/BulletConstraint3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletHelper.hpp>
|
||||
#include <BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h>
|
||||
#include <BulletDynamics/Dynamics/btDynamicsWorld.h>
|
||||
#include <Nazara/BulletPhysics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
BulletConstraint3D::BulletConstraint3D(std::unique_ptr<btTypedConstraint> constraint, bool disableCollisions) :
|
||||
m_constraint(std::move(constraint)),
|
||||
m_bodyCollisionEnabled(!disableCollisions)
|
||||
{
|
||||
btDynamicsWorld* world = GetWorld().GetDynamicsWorld();
|
||||
world->addConstraint(m_constraint.get(), disableCollisions);
|
||||
}
|
||||
|
||||
BulletConstraint3D::BulletConstraint3D(BulletConstraint3D&& constraint) noexcept :
|
||||
m_constraint(std::move(constraint.m_constraint)),
|
||||
m_bodyCollisionEnabled(constraint.m_bodyCollisionEnabled)
|
||||
{
|
||||
if (m_constraint)
|
||||
m_constraint->setUserConstraintPtr(this);
|
||||
}
|
||||
|
||||
BulletConstraint3D::~BulletConstraint3D()
|
||||
{
|
||||
if (m_constraint)
|
||||
{
|
||||
btDynamicsWorld* world = GetWorld().GetDynamicsWorld();
|
||||
world->removeConstraint(m_constraint.get());
|
||||
}
|
||||
}
|
||||
|
||||
BulletRigidBody3D& BulletConstraint3D::GetBodyA()
|
||||
{
|
||||
return *static_cast<BulletRigidBody3D*>(m_constraint->getRigidBodyA().getUserPointer());
|
||||
}
|
||||
|
||||
const BulletRigidBody3D& BulletConstraint3D::GetBodyA() const
|
||||
{
|
||||
return *static_cast<BulletRigidBody3D*>(m_constraint->getRigidBodyA().getUserPointer());
|
||||
}
|
||||
|
||||
BulletRigidBody3D& BulletConstraint3D::GetBodyB()
|
||||
{
|
||||
NazaraAssert(!IsSingleBody(), "constraint is not attached to a second body");
|
||||
return *static_cast<BulletRigidBody3D*>(m_constraint->getRigidBodyB().getUserPointer());
|
||||
}
|
||||
|
||||
const BulletRigidBody3D& BulletConstraint3D::GetBodyB() const
|
||||
{
|
||||
NazaraAssert(!IsSingleBody(), "constraint is not attached to a second body");
|
||||
return *static_cast<BulletRigidBody3D*>(m_constraint->getRigidBodyB().getUserPointer());
|
||||
}
|
||||
|
||||
BulletPhysWorld3D& BulletConstraint3D::GetWorld()
|
||||
{
|
||||
return *GetBodyA().GetWorld();
|
||||
}
|
||||
|
||||
const BulletPhysWorld3D& BulletConstraint3D::GetWorld() const
|
||||
{
|
||||
return *GetBodyA().GetWorld();
|
||||
}
|
||||
|
||||
bool BulletConstraint3D::IsSingleBody() const
|
||||
{
|
||||
return &m_constraint->getRigidBodyB() == &btTypedConstraint::getFixedBody();
|
||||
}
|
||||
|
||||
BulletConstraint3D& BulletConstraint3D::operator=(BulletConstraint3D&& constraint) noexcept
|
||||
{
|
||||
m_constraint.reset();
|
||||
|
||||
m_constraint = std::move(constraint.m_constraint);
|
||||
m_bodyCollisionEnabled = constraint.m_bodyCollisionEnabled;
|
||||
|
||||
if (m_constraint)
|
||||
m_constraint->setUserConstraintPtr(this);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
BulletPivotConstraint3D::BulletPivotConstraint3D(BulletRigidBody3D& first, const Vector3f& pivot) :
|
||||
BulletConstraint3D(std::make_unique<btPoint2PointConstraint>(*first.GetRigidBody(), ToBullet(first.ToLocal(pivot))))
|
||||
{
|
||||
}
|
||||
|
||||
BulletPivotConstraint3D::BulletPivotConstraint3D(BulletRigidBody3D& first, BulletRigidBody3D& second, const Vector3f& pivot, bool disableCollisions) :
|
||||
BulletConstraint3D(std::make_unique<btPoint2PointConstraint>(*first.GetRigidBody(), *second.GetRigidBody(), ToBullet(first.ToLocal(pivot)), ToBullet(second.ToLocal(pivot))), disableCollisions)
|
||||
{
|
||||
}
|
||||
|
||||
BulletPivotConstraint3D::BulletPivotConstraint3D(BulletRigidBody3D& first, BulletRigidBody3D& second, const Vector3f& firstAnchor, const Vector3f& secondAnchor, bool disableCollisions) :
|
||||
BulletConstraint3D(std::make_unique<btPoint2PointConstraint>(*first.GetRigidBody(), *second.GetRigidBody(), ToBullet(firstAnchor), ToBullet(secondAnchor)), disableCollisions)
|
||||
{
|
||||
}
|
||||
|
||||
Vector3f BulletPivotConstraint3D::GetFirstAnchor() const
|
||||
{
|
||||
return FromBullet(GetConstraint<btPoint2PointConstraint>()->getPivotInA());
|
||||
}
|
||||
|
||||
Vector3f BulletPivotConstraint3D::GetSecondAnchor() const
|
||||
{
|
||||
return FromBullet(GetConstraint<btPoint2PointConstraint>()->getPivotInB());
|
||||
}
|
||||
|
||||
void BulletPivotConstraint3D::SetFirstAnchor(const Vector3f& firstAnchor)
|
||||
{
|
||||
GetConstraint<btPoint2PointConstraint>()->setPivotA(ToBullet(firstAnchor));
|
||||
}
|
||||
|
||||
void BulletPivotConstraint3D::SetSecondAnchor(const Vector3f& secondAnchor)
|
||||
{
|
||||
GetConstraint<btPoint2PointConstraint>()->setPivotB(ToBullet(secondAnchor));
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_PHYSICS3D_BULLETHELPER_HPP
|
||||
#define NAZARA_PHYSICS3D_BULLETHELPER_HPP
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_BULLETHELPER_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_BULLETHELPER_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Config.hpp>
|
||||
#include <Nazara/Math/Matrix4.hpp>
|
||||
#include <Nazara/Math/Quaternion.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <Nazara/Physics3D/Config.hpp>
|
||||
#include <LinearMath/btQuaternion.h>
|
||||
#include <LinearMath/btTransform.h>
|
||||
#include <LinearMath/btVector3.h>
|
||||
@@ -27,6 +27,6 @@ namespace Nz
|
||||
inline btVector3 ToBullet(const Vector3f& vec);
|
||||
}
|
||||
|
||||
#include <Nazara/Physics3D/BulletHelper.inl>
|
||||
#include <Nazara/BulletPhysics3D/BulletHelper.inl>
|
||||
|
||||
#endif // NAZARA_PHYSICS3D_BULLETHELPER_HPP
|
||||
#endif // NAZARA_BULLETPHYSICS3D_BULLETHELPER_HPP
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Physics3D/Debug.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -57,4 +57,4 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Physics3D/DebugOff.hpp>
|
||||
#include <Nazara/BulletPhysics3D/DebugOff.hpp>
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Physics3D/PhysWorld3D.hpp>
|
||||
#include <Nazara/Physics3D/BulletHelper.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletPhysWorld3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletHelper.hpp>
|
||||
#include <Nazara/Utils/MemoryPool.hpp>
|
||||
#include <Nazara/Utils/StackVector.hpp>
|
||||
#include <BulletCollision/BroadphaseCollision/btDbvtBroadphase.h>
|
||||
@@ -12,11 +12,11 @@
|
||||
#include <BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h>
|
||||
#include <BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
|
||||
#include <cassert>
|
||||
#include <Nazara/Physics3D/Debug.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
struct PhysWorld3D::BulletWorld
|
||||
struct BulletPhysWorld3D::BulletWorld
|
||||
{
|
||||
btDefaultCollisionConfiguration collisionConfiguration;
|
||||
btCollisionDispatcher dispatcher;
|
||||
@@ -39,7 +39,7 @@ namespace Nz
|
||||
BulletWorld& operator=(BulletWorld&&) = delete;
|
||||
};
|
||||
|
||||
PhysWorld3D::PhysWorld3D() :
|
||||
BulletPhysWorld3D::BulletPhysWorld3D() :
|
||||
m_maxStepCount(50),
|
||||
m_gravity(Vector3f::Zero()),
|
||||
m_stepSize(Time::TickDuration(120)),
|
||||
@@ -48,29 +48,29 @@ namespace Nz
|
||||
m_world = std::make_unique<BulletWorld>();
|
||||
}
|
||||
|
||||
PhysWorld3D::~PhysWorld3D() = default;
|
||||
BulletPhysWorld3D::~BulletPhysWorld3D() = default;
|
||||
|
||||
btDynamicsWorld* PhysWorld3D::GetDynamicsWorld()
|
||||
btDynamicsWorld* BulletPhysWorld3D::GetDynamicsWorld()
|
||||
{
|
||||
return &m_world->dynamicWorld;
|
||||
}
|
||||
|
||||
Vector3f PhysWorld3D::GetGravity() const
|
||||
Vector3f BulletPhysWorld3D::GetGravity() const
|
||||
{
|
||||
return FromBullet(m_world->dynamicWorld.getGravity());
|
||||
}
|
||||
|
||||
std::size_t PhysWorld3D::GetMaxStepCount() const
|
||||
std::size_t BulletPhysWorld3D::GetMaxStepCount() const
|
||||
{
|
||||
return m_maxStepCount;
|
||||
}
|
||||
|
||||
Time PhysWorld3D::GetStepSize() const
|
||||
Time BulletPhysWorld3D::GetStepSize() const
|
||||
{
|
||||
return m_stepSize;
|
||||
}
|
||||
|
||||
bool PhysWorld3D::RaycastQueryFirst(const Vector3f& from, const Vector3f& to, RaycastHit* hitInfo)
|
||||
bool BulletPhysWorld3D::RaycastQueryFirst(const Vector3f& from, const Vector3f& to, RaycastHit* hitInfo)
|
||||
{
|
||||
btCollisionWorld::ClosestRayResultCallback callback(ToBullet(from), ToBullet(to));
|
||||
m_world->dynamicWorld.rayTest(ToBullet(from), ToBullet(to), callback);
|
||||
@@ -85,28 +85,28 @@ namespace Nz
|
||||
hitInfo->hitPosition = FromBullet(callback.m_hitPointWorld);
|
||||
|
||||
if (const btRigidBody* body = btRigidBody::upcast(callback.m_collisionObject))
|
||||
hitInfo->hitBody = static_cast<RigidBody3D*>(body->getUserPointer());
|
||||
hitInfo->hitBody = static_cast<BulletRigidBody3D*>(body->getUserPointer());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void PhysWorld3D::SetGravity(const Vector3f& gravity)
|
||||
void BulletPhysWorld3D::SetGravity(const Vector3f& gravity)
|
||||
{
|
||||
m_world->dynamicWorld.setGravity(ToBullet(gravity));
|
||||
}
|
||||
|
||||
void PhysWorld3D::SetMaxStepCount(std::size_t maxStepCount)
|
||||
void BulletPhysWorld3D::SetMaxStepCount(std::size_t maxStepCount)
|
||||
{
|
||||
m_maxStepCount = maxStepCount;
|
||||
}
|
||||
|
||||
void PhysWorld3D::SetStepSize(Time stepSize)
|
||||
void BulletPhysWorld3D::SetStepSize(Time stepSize)
|
||||
{
|
||||
m_stepSize = stepSize;
|
||||
}
|
||||
|
||||
void PhysWorld3D::Step(Time timestep)
|
||||
void BulletPhysWorld3D::Step(Time timestep)
|
||||
{
|
||||
m_timestepAccumulator += timestep;
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
btRigidBody* PhysWorld3D::AddRigidBody(std::size_t& rigidBodyIndex, FunctionRef<void(btRigidBody* body)> constructor)
|
||||
btRigidBody* BulletPhysWorld3D::AddRigidBody(std::size_t& rigidBodyIndex, FunctionRef<void(btRigidBody* body)> constructor)
|
||||
{
|
||||
btRigidBody* rigidBody = m_world->rigidBodyPool.Allocate(m_world->rigidBodyPool.DeferConstruct, rigidBodyIndex);
|
||||
constructor(rigidBody);
|
||||
@@ -148,7 +148,7 @@ namespace Nz
|
||||
return rigidBody;
|
||||
}
|
||||
|
||||
void PhysWorld3D::RemoveRigidBody(btRigidBody* rigidBody, std::size_t rigidBodyIndex)
|
||||
void BulletPhysWorld3D::RemoveRigidBody(btRigidBody* rigidBody, std::size_t rigidBodyIndex)
|
||||
{
|
||||
// TODO: Improve deletion (since rigid bodies are sorted)
|
||||
m_world->dynamicWorld.removeRigidBody(rigidBody); //< this does a linear search
|
||||
21
src/Nazara/BulletPhysics3D/BulletPhysics3D.cpp
Normal file
21
src/Nazara/BulletPhysics3D/BulletPhysics3D.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/BulletPhysics3D/BulletPhysics3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletCollider3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Config.hpp>
|
||||
#include <Nazara/Core/Core.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/Log.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
BulletPhysics3D::BulletPhysics3D(Config /*config*/) :
|
||||
ModuleBase("BulletPhysics3D", this)
|
||||
{
|
||||
}
|
||||
|
||||
BulletPhysics3D* BulletPhysics3D::s_instance;
|
||||
}
|
||||
@@ -1,26 +1,26 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Physics3D/RigidBody3D.hpp>
|
||||
#include <Nazara/Physics3D/BulletHelper.hpp>
|
||||
#include <Nazara/Physics3D/PhysWorld3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletRigidBody3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletHelper.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletPhysWorld3D.hpp>
|
||||
#include <Nazara/Utils/MemoryHelper.hpp>
|
||||
#include <BulletDynamics/Dynamics/btDynamicsWorld.h>
|
||||
#include <BulletDynamics/Dynamics/btRigidBody.h>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <Nazara/Physics3D/Debug.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
RigidBody3D::RigidBody3D(PhysWorld3D* world, const Matrix4f& mat) :
|
||||
RigidBody3D(world, nullptr, mat)
|
||||
BulletRigidBody3D::BulletRigidBody3D(BulletPhysWorld3D* world, const Matrix4f& mat) :
|
||||
BulletRigidBody3D(world, nullptr, mat)
|
||||
{
|
||||
}
|
||||
|
||||
RigidBody3D::RigidBody3D(PhysWorld3D* world, std::shared_ptr<Collider3D> geom, const Matrix4f& mat) :
|
||||
BulletRigidBody3D::BulletRigidBody3D(BulletPhysWorld3D* world, std::shared_ptr<BulletCollider3D> geom, const Matrix4f& mat) :
|
||||
m_geom(std::move(geom)),
|
||||
m_world(world)
|
||||
{
|
||||
@@ -42,7 +42,7 @@ namespace Nz
|
||||
m_body->setUserPointer(this);
|
||||
}
|
||||
|
||||
RigidBody3D::RigidBody3D(RigidBody3D&& object) noexcept :
|
||||
BulletRigidBody3D::BulletRigidBody3D(BulletRigidBody3D&& object) noexcept :
|
||||
m_geom(std::move(object.m_geom)),
|
||||
m_bodyPoolIndex(object.m_bodyPoolIndex),
|
||||
m_body(object.m_body),
|
||||
@@ -54,12 +54,12 @@ namespace Nz
|
||||
object.m_body = nullptr;
|
||||
}
|
||||
|
||||
RigidBody3D::~RigidBody3D()
|
||||
BulletRigidBody3D::~BulletRigidBody3D()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void RigidBody3D::AddForce(const Vector3f& force, CoordSys coordSys)
|
||||
void BulletRigidBody3D::AddForce(const Vector3f& force, CoordSys coordSys)
|
||||
{
|
||||
switch (coordSys)
|
||||
{
|
||||
@@ -75,7 +75,7 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
void RigidBody3D::AddForce(const Vector3f& force, const Vector3f& point, CoordSys coordSys)
|
||||
void BulletRigidBody3D::AddForce(const Vector3f& force, const Vector3f& point, CoordSys coordSys)
|
||||
{
|
||||
switch (coordSys)
|
||||
{
|
||||
@@ -92,7 +92,7 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
void RigidBody3D::AddTorque(const Vector3f& torque, CoordSys coordSys)
|
||||
void BulletRigidBody3D::AddTorque(const Vector3f& torque, CoordSys coordSys)
|
||||
{
|
||||
switch (coordSys)
|
||||
{
|
||||
@@ -109,7 +109,7 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
void RigidBody3D::EnableSleeping(bool enable)
|
||||
void BulletRigidBody3D::EnableSleeping(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
@@ -123,13 +123,13 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
void RigidBody3D::FallAsleep()
|
||||
void BulletRigidBody3D::FallAsleep()
|
||||
{
|
||||
if (m_body->getActivationState() != DISABLE_DEACTIVATION)
|
||||
m_body->setActivationState(ISLAND_SLEEPING);
|
||||
}
|
||||
|
||||
Boxf RigidBody3D::GetAABB() const
|
||||
Boxf BulletRigidBody3D::GetAABB() const
|
||||
{
|
||||
btVector3 min, max;
|
||||
m_body->getAabb(min, max);
|
||||
@@ -137,77 +137,77 @@ namespace Nz
|
||||
return Boxf(FromBullet(min), FromBullet(max));
|
||||
}
|
||||
|
||||
float RigidBody3D::GetAngularDamping() const
|
||||
float BulletRigidBody3D::GetAngularDamping() const
|
||||
{
|
||||
return m_body->getAngularDamping();
|
||||
}
|
||||
|
||||
Vector3f RigidBody3D::GetAngularVelocity() const
|
||||
Vector3f BulletRigidBody3D::GetAngularVelocity() const
|
||||
{
|
||||
return FromBullet(m_body->getAngularVelocity());
|
||||
}
|
||||
|
||||
float RigidBody3D::GetLinearDamping() const
|
||||
float BulletRigidBody3D::GetLinearDamping() const
|
||||
{
|
||||
return m_body->getLinearDamping();
|
||||
}
|
||||
|
||||
Vector3f RigidBody3D::GetLinearVelocity() const
|
||||
Vector3f BulletRigidBody3D::GetLinearVelocity() const
|
||||
{
|
||||
return FromBullet(m_body->getLinearVelocity());
|
||||
}
|
||||
|
||||
float RigidBody3D::GetMass() const
|
||||
float BulletRigidBody3D::GetMass() const
|
||||
{
|
||||
return m_body->getMass();
|
||||
}
|
||||
|
||||
Vector3f RigidBody3D::GetMassCenter(CoordSys coordSys) const
|
||||
Vector3f BulletRigidBody3D::GetMassCenter(CoordSys coordSys) const
|
||||
{
|
||||
return FromBullet(m_body->getCenterOfMassPosition());
|
||||
}
|
||||
|
||||
Matrix4f RigidBody3D::GetMatrix() const
|
||||
Matrix4f BulletRigidBody3D::GetMatrix() const
|
||||
{
|
||||
return FromBullet(m_body->getWorldTransform());
|
||||
}
|
||||
|
||||
Vector3f RigidBody3D::GetPosition() const
|
||||
Vector3f BulletRigidBody3D::GetPosition() const
|
||||
{
|
||||
return FromBullet(m_body->getWorldTransform().getOrigin());
|
||||
}
|
||||
|
||||
Quaternionf RigidBody3D::GetRotation() const
|
||||
Quaternionf BulletRigidBody3D::GetRotation() const
|
||||
{
|
||||
return FromBullet(m_body->getWorldTransform().getRotation());
|
||||
}
|
||||
|
||||
bool RigidBody3D::IsSimulationEnabled() const
|
||||
bool BulletRigidBody3D::IsSimulationEnabled() const
|
||||
{
|
||||
return m_body->isActive();
|
||||
}
|
||||
|
||||
bool RigidBody3D::IsSleeping() const
|
||||
bool BulletRigidBody3D::IsSleeping() const
|
||||
{
|
||||
return m_body->getActivationState() == ISLAND_SLEEPING;
|
||||
}
|
||||
|
||||
bool RigidBody3D::IsSleepingEnabled() const
|
||||
bool BulletRigidBody3D::IsSleepingEnabled() const
|
||||
{
|
||||
return m_body->getActivationState() != DISABLE_DEACTIVATION;
|
||||
}
|
||||
|
||||
void RigidBody3D::SetAngularDamping(float angularDamping)
|
||||
void BulletRigidBody3D::SetAngularDamping(float angularDamping)
|
||||
{
|
||||
m_body->setDamping(m_body->getLinearDamping(), angularDamping);
|
||||
}
|
||||
|
||||
void RigidBody3D::SetAngularVelocity(const Vector3f& angularVelocity)
|
||||
void BulletRigidBody3D::SetAngularVelocity(const Vector3f& angularVelocity)
|
||||
{
|
||||
m_body->setAngularVelocity(ToBullet(angularVelocity));
|
||||
}
|
||||
|
||||
void RigidBody3D::SetGeom(std::shared_ptr<Collider3D> geom, bool recomputeInertia)
|
||||
void BulletRigidBody3D::SetGeom(std::shared_ptr<BulletCollider3D> geom, bool recomputeInertia)
|
||||
{
|
||||
if (m_geom != geom)
|
||||
{
|
||||
@@ -229,17 +229,17 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
void RigidBody3D::SetLinearDamping(float damping)
|
||||
void BulletRigidBody3D::SetLinearDamping(float damping)
|
||||
{
|
||||
m_body->setDamping(damping, m_body->getAngularDamping());
|
||||
}
|
||||
|
||||
void RigidBody3D::SetLinearVelocity(const Vector3f& velocity)
|
||||
void BulletRigidBody3D::SetLinearVelocity(const Vector3f& velocity)
|
||||
{
|
||||
m_body->setLinearVelocity(ToBullet(velocity));
|
||||
}
|
||||
|
||||
void RigidBody3D::SetMass(float mass)
|
||||
void BulletRigidBody3D::SetMass(float mass)
|
||||
{
|
||||
NazaraAssert(mass >= 0.f, "Mass must be positive and finite");
|
||||
NazaraAssert(std::isfinite(mass), "Mass must be positive and finite");
|
||||
@@ -250,7 +250,7 @@ namespace Nz
|
||||
m_body->setMassProps(mass, ToBullet(inertia));
|
||||
}
|
||||
|
||||
void RigidBody3D::SetMassCenter(const Vector3f& center)
|
||||
void BulletRigidBody3D::SetMassCenter(const Vector3f& center)
|
||||
{
|
||||
btTransform centerTransform;
|
||||
centerTransform.setIdentity();
|
||||
@@ -259,7 +259,7 @@ namespace Nz
|
||||
m_body->setCenterOfMassTransform(centerTransform);
|
||||
}
|
||||
|
||||
void RigidBody3D::SetPosition(const Vector3f& position)
|
||||
void BulletRigidBody3D::SetPosition(const Vector3f& position)
|
||||
{
|
||||
btTransform worldTransform = m_body->getWorldTransform();
|
||||
worldTransform.setOrigin(ToBullet(position));
|
||||
@@ -267,7 +267,7 @@ namespace Nz
|
||||
m_body->setWorldTransform(worldTransform);
|
||||
}
|
||||
|
||||
void RigidBody3D::SetRotation(const Quaternionf& rotation)
|
||||
void BulletRigidBody3D::SetRotation(const Quaternionf& rotation)
|
||||
{
|
||||
btTransform worldTransform = m_body->getWorldTransform();
|
||||
worldTransform.setRotation(ToBullet(rotation));
|
||||
@@ -275,33 +275,33 @@ namespace Nz
|
||||
m_body->setWorldTransform(worldTransform);
|
||||
}
|
||||
|
||||
Quaternionf RigidBody3D::ToLocal(const Quaternionf& worldRotation)
|
||||
Quaternionf BulletRigidBody3D::ToLocal(const Quaternionf& worldRotation)
|
||||
{
|
||||
return GetRotation().Conjugate() * worldRotation;
|
||||
}
|
||||
|
||||
Vector3f RigidBody3D::ToLocal(const Vector3f& worldPosition)
|
||||
Vector3f BulletRigidBody3D::ToLocal(const Vector3f& worldPosition)
|
||||
{
|
||||
btTransform worldTransform = m_body->getWorldTransform();
|
||||
return GetMatrix().InverseTransform() * worldPosition;
|
||||
}
|
||||
|
||||
Quaternionf RigidBody3D::ToWorld(const Quaternionf& localRotation)
|
||||
Quaternionf BulletRigidBody3D::ToWorld(const Quaternionf& localRotation)
|
||||
{
|
||||
return GetRotation() * localRotation;
|
||||
}
|
||||
|
||||
Vector3f RigidBody3D::ToWorld(const Vector3f& localPosition)
|
||||
Vector3f BulletRigidBody3D::ToWorld(const Vector3f& localPosition)
|
||||
{
|
||||
return GetMatrix() * localPosition;
|
||||
}
|
||||
|
||||
void RigidBody3D::WakeUp()
|
||||
void BulletRigidBody3D::WakeUp()
|
||||
{
|
||||
m_body->activate();
|
||||
}
|
||||
|
||||
RigidBody3D& RigidBody3D::operator=(RigidBody3D&& object) noexcept
|
||||
BulletRigidBody3D& BulletRigidBody3D::operator=(BulletRigidBody3D&& object) noexcept
|
||||
{
|
||||
Destroy();
|
||||
|
||||
@@ -318,7 +318,7 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
void RigidBody3D::Destroy()
|
||||
void BulletRigidBody3D::Destroy()
|
||||
{
|
||||
if (m_body)
|
||||
{
|
||||
@@ -0,0 +1,10 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/BulletPhysics3D/Components/BulletRigidBody3DComponent.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
}
|
||||
@@ -1,32 +1,32 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Physics3D/Systems/Physics3DSystem.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Systems/BulletPhysics3DSystem.hpp>
|
||||
#include <Nazara/Utility/Components/NodeComponent.hpp>
|
||||
#include <Nazara/Physics3D/Debug.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
Physics3DSystem::Physics3DSystem(entt::registry& registry) :
|
||||
BulletPhysics3DSystem::BulletPhysics3DSystem(entt::registry& registry) :
|
||||
m_registry(registry),
|
||||
m_physicsConstructObserver(m_registry, entt::collector.group<RigidBody3DComponent, NodeComponent>())
|
||||
m_physicsConstructObserver(m_registry, entt::collector.group<BulletRigidBody3DComponent, NodeComponent>())
|
||||
{
|
||||
m_constructConnection = registry.on_construct<RigidBody3DComponent>().connect<&Physics3DSystem::OnConstruct>(this);
|
||||
m_destructConnection = registry.on_destroy<RigidBody3DComponent>().connect<&Physics3DSystem::OnDestruct>(this);
|
||||
m_constructConnection = registry.on_construct<BulletRigidBody3DComponent>().connect<&BulletPhysics3DSystem::OnConstruct>(this);
|
||||
m_destructConnection = registry.on_destroy<BulletRigidBody3DComponent>().connect<&BulletPhysics3DSystem::OnDestruct>(this);
|
||||
}
|
||||
|
||||
Physics3DSystem::~Physics3DSystem()
|
||||
BulletPhysics3DSystem::~BulletPhysics3DSystem()
|
||||
{
|
||||
m_physicsConstructObserver.disconnect();
|
||||
|
||||
// Ensure every RigidBody3D is destroyed before world is
|
||||
auto rigidBodyView = m_registry.view<RigidBody3DComponent>();
|
||||
auto rigidBodyView = m_registry.view<BulletRigidBody3DComponent>();
|
||||
for (auto [entity, rigidBodyComponent] : rigidBodyView.each())
|
||||
rigidBodyComponent.Destroy();
|
||||
}
|
||||
|
||||
bool Physics3DSystem::RaycastQueryFirst(const Vector3f& from, const Vector3f& to, RaycastHit* hitInfo)
|
||||
bool BulletPhysics3DSystem::RaycastQueryFirst(const Vector3f& from, const Vector3f& to, RaycastHit* hitInfo)
|
||||
{
|
||||
if (!m_physWorld.RaycastQueryFirst(from, to, hitInfo))
|
||||
return false;
|
||||
@@ -41,12 +41,12 @@ namespace Nz
|
||||
return true;
|
||||
}
|
||||
|
||||
void Physics3DSystem::Update(Time elapsedTime)
|
||||
void BulletPhysics3DSystem::Update(Time elapsedTime)
|
||||
{
|
||||
// Move newly-created physics entities to their node position/rotation
|
||||
m_physicsConstructObserver.each([&](entt::entity entity)
|
||||
{
|
||||
RigidBody3DComponent& entityPhysics = m_registry.get<RigidBody3DComponent>(entity);
|
||||
BulletRigidBody3DComponent& entityPhysics = m_registry.get<BulletRigidBody3DComponent>(entity);
|
||||
NodeComponent& entityNode = m_registry.get<NodeComponent>(entity);
|
||||
|
||||
entityPhysics.SetPosition(entityNode.GetPosition(CoordSys::Global));
|
||||
@@ -58,7 +58,7 @@ namespace Nz
|
||||
|
||||
// Replicate rigid body position to their node components
|
||||
// TODO: Only replicate active entities
|
||||
auto view = m_registry.view<NodeComponent, const RigidBody3DComponent>();
|
||||
auto view = m_registry.view<NodeComponent, const BulletRigidBody3DComponent>();
|
||||
for (auto [entity, nodeComponent, rigidBodyComponent] : view.each())
|
||||
{
|
||||
if (rigidBodyComponent.IsSleeping())
|
||||
@@ -69,10 +69,10 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
void Physics3DSystem::OnConstruct(entt::registry& registry, entt::entity entity)
|
||||
void BulletPhysics3DSystem::OnConstruct(entt::registry& registry, entt::entity entity)
|
||||
{
|
||||
// Register rigid body owning entity
|
||||
RigidBody3DComponent& rigidBody = registry.get<RigidBody3DComponent>(entity);
|
||||
BulletRigidBody3DComponent& rigidBody = registry.get<BulletRigidBody3DComponent>(entity);
|
||||
std::size_t uniqueIndex = rigidBody.GetUniqueIndex();
|
||||
if (uniqueIndex >= m_physicsEntities.size())
|
||||
m_physicsEntities.resize(uniqueIndex + 1);
|
||||
@@ -80,10 +80,10 @@ namespace Nz
|
||||
m_physicsEntities[uniqueIndex] = entity;
|
||||
}
|
||||
|
||||
void Physics3DSystem::OnDestruct(entt::registry& registry, entt::entity entity)
|
||||
void BulletPhysics3DSystem::OnDestruct(entt::registry& registry, entt::entity entity)
|
||||
{
|
||||
// Unregister owning entity
|
||||
RigidBody3DComponent& rigidBody = registry.get<RigidBody3DComponent>(entity);
|
||||
BulletRigidBody3DComponent& rigidBody = registry.get<BulletRigidBody3DComponent>(entity);
|
||||
std::size_t uniqueIndex = rigidBody.GetUniqueIndex();
|
||||
assert(uniqueIndex <= m_physicsEntities.size());
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Physics3D/Components/RigidBody3DComponent.hpp>
|
||||
#include <Nazara/Physics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Physics3D/Constraint3D.hpp>
|
||||
#include <Nazara/Physics3D/BulletHelper.hpp>
|
||||
#include <BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h>
|
||||
#include <BulletDynamics/Dynamics/btDynamicsWorld.h>
|
||||
#include <Nazara/Physics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
Constraint3D::Constraint3D(std::unique_ptr<btTypedConstraint> constraint, bool disableCollisions) :
|
||||
m_constraint(std::move(constraint)),
|
||||
m_bodyCollisionEnabled(!disableCollisions)
|
||||
{
|
||||
btDynamicsWorld* world = GetWorld().GetDynamicsWorld();
|
||||
world->addConstraint(m_constraint.get(), disableCollisions);
|
||||
}
|
||||
|
||||
Constraint3D::Constraint3D(Constraint3D&& constraint) noexcept :
|
||||
m_constraint(std::move(constraint.m_constraint)),
|
||||
m_bodyCollisionEnabled(constraint.m_bodyCollisionEnabled)
|
||||
{
|
||||
if (m_constraint)
|
||||
m_constraint->setUserConstraintPtr(this);
|
||||
}
|
||||
|
||||
Constraint3D::~Constraint3D()
|
||||
{
|
||||
if (m_constraint)
|
||||
{
|
||||
btDynamicsWorld* world = GetWorld().GetDynamicsWorld();
|
||||
world->removeConstraint(m_constraint.get());
|
||||
}
|
||||
}
|
||||
|
||||
RigidBody3D& Constraint3D::GetBodyA()
|
||||
{
|
||||
return *static_cast<RigidBody3D*>(m_constraint->getRigidBodyA().getUserPointer());
|
||||
}
|
||||
|
||||
const RigidBody3D& Constraint3D::GetBodyA() const
|
||||
{
|
||||
return *static_cast<RigidBody3D*>(m_constraint->getRigidBodyA().getUserPointer());
|
||||
}
|
||||
|
||||
RigidBody3D& Constraint3D::GetBodyB()
|
||||
{
|
||||
NazaraAssert(!IsSingleBody(), "constraint is not attached to a second body");
|
||||
return *static_cast<RigidBody3D*>(m_constraint->getRigidBodyB().getUserPointer());
|
||||
}
|
||||
|
||||
const RigidBody3D& Constraint3D::GetBodyB() const
|
||||
{
|
||||
NazaraAssert(!IsSingleBody(), "constraint is not attached to a second body");
|
||||
return *static_cast<RigidBody3D*>(m_constraint->getRigidBodyB().getUserPointer());
|
||||
}
|
||||
|
||||
PhysWorld3D& Constraint3D::GetWorld()
|
||||
{
|
||||
return *GetBodyA().GetWorld();
|
||||
}
|
||||
|
||||
const PhysWorld3D& Constraint3D::GetWorld() const
|
||||
{
|
||||
return *GetBodyA().GetWorld();
|
||||
}
|
||||
|
||||
bool Constraint3D::IsSingleBody() const
|
||||
{
|
||||
return &m_constraint->getRigidBodyB() == &btTypedConstraint::getFixedBody();
|
||||
}
|
||||
|
||||
Constraint3D& Constraint3D::operator=(Constraint3D&& constraint) noexcept
|
||||
{
|
||||
m_constraint.reset();
|
||||
|
||||
m_constraint = std::move(constraint.m_constraint);
|
||||
m_bodyCollisionEnabled = constraint.m_bodyCollisionEnabled;
|
||||
|
||||
if (m_constraint)
|
||||
m_constraint->setUserConstraintPtr(this);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
PivotConstraint3D::PivotConstraint3D(RigidBody3D& first, const Vector3f& pivot) :
|
||||
Constraint3D(std::make_unique<btPoint2PointConstraint>(*first.GetRigidBody(), ToBullet(first.ToLocal(pivot))))
|
||||
{
|
||||
}
|
||||
|
||||
PivotConstraint3D::PivotConstraint3D(RigidBody3D& first, RigidBody3D& second, const Vector3f& pivot, bool disableCollisions) :
|
||||
Constraint3D(std::make_unique<btPoint2PointConstraint>(*first.GetRigidBody(), *second.GetRigidBody(), ToBullet(first.ToLocal(pivot)), ToBullet(second.ToLocal(pivot))), disableCollisions)
|
||||
{
|
||||
}
|
||||
|
||||
PivotConstraint3D::PivotConstraint3D(RigidBody3D& first, RigidBody3D& second, const Vector3f& firstAnchor, const Vector3f& secondAnchor, bool disableCollisions) :
|
||||
Constraint3D(std::make_unique<btPoint2PointConstraint>(*first.GetRigidBody(), *second.GetRigidBody(), ToBullet(firstAnchor), ToBullet(secondAnchor)), disableCollisions)
|
||||
{
|
||||
}
|
||||
|
||||
Vector3f PivotConstraint3D::GetFirstAnchor() const
|
||||
{
|
||||
return FromBullet(GetConstraint<btPoint2PointConstraint>()->getPivotInA());
|
||||
}
|
||||
|
||||
Vector3f PivotConstraint3D::GetSecondAnchor() const
|
||||
{
|
||||
return FromBullet(GetConstraint<btPoint2PointConstraint>()->getPivotInB());
|
||||
}
|
||||
|
||||
void PivotConstraint3D::SetFirstAnchor(const Vector3f& firstAnchor)
|
||||
{
|
||||
GetConstraint<btPoint2PointConstraint>()->setPivotA(ToBullet(firstAnchor));
|
||||
}
|
||||
|
||||
void PivotConstraint3D::SetSecondAnchor(const Vector3f& secondAnchor)
|
||||
{
|
||||
GetConstraint<btPoint2PointConstraint>()->setPivotB(ToBullet(secondAnchor));
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Physics3D/Physics3D.hpp>
|
||||
#include <Nazara/Core/Core.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/Log.hpp>
|
||||
#include <Nazara/Physics3D/Collider3D.hpp>
|
||||
#include <Nazara/Physics3D/Config.hpp>
|
||||
#include <Nazara/Physics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
Physics3D::Physics3D(Config /*config*/) :
|
||||
ModuleBase("Physics3D", this)
|
||||
{
|
||||
}
|
||||
|
||||
Physics3D* Physics3D::s_instance;
|
||||
}
|
||||
Reference in New Issue
Block a user