mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-25 17:11:34 +00:00
Support absence of player and other actors in physics system
This commit is contained in:
parent
76dfb1b1b4
commit
36b33cc1a5
1 changed files with 4 additions and 2 deletions
|
@ -822,7 +822,8 @@ namespace MWPhysics
|
||||||
// copy new ptr position in temporary vector. player is handled separately as its movement might change active
|
// copy new ptr position in temporary vector. player is handled separately as its movement might change active
|
||||||
// cell.
|
// cell.
|
||||||
mActorsPositions.clear();
|
mActorsPositions.clear();
|
||||||
mActorsPositions.reserve(mActors.size() - 1);
|
if (!mActors.empty())
|
||||||
|
mActorsPositions.reserve(mActors.size() - 1);
|
||||||
for (const auto& [ptr, physicActor] : mActors)
|
for (const auto& [ptr, physicActor] : mActors)
|
||||||
{
|
{
|
||||||
if (physicActor.get() == player)
|
if (physicActor.get() == player)
|
||||||
|
@ -833,7 +834,8 @@ namespace MWPhysics
|
||||||
for (const auto& [ptr, pos] : mActorsPositions)
|
for (const auto& [ptr, pos] : mActorsPositions)
|
||||||
world->moveObject(ptr, pos, false, false);
|
world->moveObject(ptr, pos, false, false);
|
||||||
|
|
||||||
world->moveObject(player->getPtr(), player->getSimulationPosition(), false, false);
|
if (player != nullptr)
|
||||||
|
world->moveObject(player->getPtr(), player->getSimulationPosition(), false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicsSystem::updateAnimatedCollisionShape(const MWWorld::Ptr& object)
|
void PhysicsSystem::updateAnimatedCollisionShape(const MWWorld::Ptr& object)
|
||||||
|
|
Loading…
Reference in a new issue