mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-26 02:41: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,6 +822,7 @@ 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();
|
||||||
|
if (!mActors.empty())
|
||||||
mActorsPositions.reserve(mActors.size() - 1);
|
mActorsPositions.reserve(mActors.size() - 1);
|
||||||
for (const auto& [ptr, physicActor] : mActors)
|
for (const auto& [ptr, physicActor] : mActors)
|
||||||
{
|
{
|
||||||
|
@ -833,6 +834,7 @@ 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);
|
||||||
|
|
||||||
|
if (player != nullptr)
|
||||||
world->moveObject(player->getPtr(), player->getSimulationPosition(), false, false);
|
world->moveObject(player->getPtr(), player->getSimulationPosition(), false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue