Upgrade Physics2D and Physics3D
This commit is contained in:
@@ -53,7 +53,7 @@ namespace Ndk
|
||||
*
|
||||
* \param geom Geometry used for collisions
|
||||
*/
|
||||
void CollisionComponent2D::SetGeom(Nz::Collider2DRef geom, bool recomputeMoment, bool recomputeMassCenter)
|
||||
void CollisionComponent2D::SetGeom(std::shared_ptr<Nz::Collider2D> geom, bool recomputeMoment, bool recomputeMassCenter)
|
||||
{
|
||||
m_geom = std::move(geom);
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Ndk
|
||||
* \remark Produces a NazaraAssert if the entity has no physics component and has no static body
|
||||
*/
|
||||
|
||||
void CollisionComponent3D::SetGeom(Nz::Collider3DRef geom)
|
||||
void CollisionComponent3D::SetGeom(std::shared_ptr<Nz::Collider3D> geom)
|
||||
{
|
||||
m_geom = std::move(geom);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Ndk
|
||||
|
||||
Nz::Vector2f positionOffset;
|
||||
|
||||
Nz::Collider2DRef geom;
|
||||
std::shared_ptr<Nz::Collider2D> geom;
|
||||
if (m_entity->HasComponent<CollisionComponent2D>())
|
||||
{
|
||||
const CollisionComponent2D& entityCollision = m_entity->GetComponent<CollisionComponent2D>();
|
||||
@@ -94,7 +94,7 @@ namespace Ndk
|
||||
if (IsComponent<CollisionComponent2D>(component))
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid object");
|
||||
m_object->SetGeom(Nz::NullCollider2D::New(), false, false);
|
||||
m_object->SetGeom(std::make_shared<Nz::NullCollider2D>(), false, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Ndk
|
||||
|
||||
Nz::PhysWorld3D& world = entityWorld->GetSystem<PhysicsSystem3D>().GetWorld();
|
||||
|
||||
Nz::Collider3DRef geom;
|
||||
std::shared_ptr<Nz::Collider3D> geom;
|
||||
if (m_entity->HasComponent<CollisionComponent3D>())
|
||||
geom = m_entity->GetComponent<CollisionComponent3D>().GetGeom();
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Ndk
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid object");
|
||||
|
||||
m_object->SetGeom(Nz::NullCollider3D::New());
|
||||
m_object->SetGeom(std::make_shared<Nz::NullCollider3D>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user