Refactor Physics to separate PhysicsBackend

#673
This commit is contained in:
Wojtek Figat
2022-01-20 23:28:43 +01:00
parent cf1af53ab8
commit 427846f73b
66 changed files with 4803 additions and 4327 deletions

View File

@@ -1814,9 +1814,9 @@ void Actor::FromJson(const StringAnsiView& json)
void Actor::SetPhysicsScene(PhysicsScene* scene)
{
ASSERT(scene);
CHECK(scene);
auto previous = GetPhysicsScene();
const auto previous = GetPhysicsScene();
_physicsScene = scene;
if (previous != _physicsScene)
@@ -1829,10 +1829,7 @@ void Actor::SetPhysicsScene(PhysicsScene* scene)
}
}
PhysicsScene* Actor::GetPhysicsScene()
PhysicsScene* Actor::GetPhysicsScene() const
{
if (_physicsScene == nullptr)
_physicsScene = Physics::DefaultScene;
return _physicsScene;
return _physicsScene ? _physicsScene : Physics::DefaultScene;
}

View File

@@ -970,10 +970,10 @@ public:
/// <summary>
/// Get the physics world the controller is part of.
/// </summary>
API_PROPERTY(Attributes="HideInEditor") PhysicsScene* GetPhysicsScene();
API_PROPERTY(Attributes="HideInEditor") PhysicsScene* GetPhysicsScene() const;
protected:
virtual void OnPhysicsSceneChanged(PhysicsScene* previous) {};
virtual void OnPhysicsSceneChanged(PhysicsScene* previous) {}
private: