Update PhysicsSystem2D (#179)

* Update

* Add: [Get/Set]AngularDaming for standardization

* Fix: Name error

* Add: [Get/Set][AngularDamping/MomentOfInertia] in PhysicsComponent2D

* Forgot in last commit

* Add: param coordSys in [PhysicsComponent2D/RigidBody2D]::SetMassCenter

* Add: Some forgotten inline

* Fix little error

* Fix: Indentation before case

* Move and Change GetCenterOfGravity

* Rename m_world into m_physWorld

* Rename GetWorld int GetPhysWorld

* Update: PhysicsSystem2D became an interface of PhysWorld2D

* Update Collison/PhysicsComponent because GetWorld was renamed

* Update tests

* Update: Make the interface usable with Entity instead of PhysicsComponent

* Update: Make GetPhysWorld private

* Update PhysicsSystem2D.hpp

* Update: indent

* Remove: useless blank line

* update order(?)

* Update PhysicsSystem2D.hpp
This commit is contained in:
Faymoon
2018-08-07 19:08:01 +02:00
committed by Jérôme Leclercq
parent 602992609f
commit 0a5e9e040d
6 changed files with 359 additions and 18 deletions

View File

@@ -56,7 +56,7 @@ namespace Ndk
NazaraAssert(entityWorld, "Entity must have world");
NazaraAssert(entityWorld->HasSystem<PhysicsSystem2D>(), "World must have a physics system");
Nz::PhysWorld2D& physWorld = entityWorld->GetSystem<PhysicsSystem2D>().GetWorld();
Nz::PhysWorld2D& physWorld = entityWorld->GetSystem<PhysicsSystem2D>().GetPhysWorld();
m_staticBody = std::make_unique<Nz::RigidBody2D>(&physWorld, 0.f, m_geom);
m_staticBody->SetUserdata(reinterpret_cast<void*>(static_cast<std::ptrdiff_t>(m_entity->GetId())));

View File

@@ -29,7 +29,7 @@ namespace Ndk
World* entityWorld = m_entity->GetWorld();
NazaraAssert(entityWorld->HasSystem<PhysicsSystem2D>(), "World must have a 2D physics system");
Nz::PhysWorld2D& world = entityWorld->GetSystem<PhysicsSystem2D>().GetWorld();
Nz::PhysWorld2D& world = entityWorld->GetSystem<PhysicsSystem2D>().GetPhysWorld();
Nz::Collider2DRef geom;
if (m_entity->HasComponent<CollisionComponent2D>())