forked from teamnwah/openmw-tes3coop
Use safePlaceObject in spawnRandomCreature
This commit is contained in:
parent
7485abe5c3
commit
36bb255bc0
1 changed files with 1 additions and 15 deletions
|
@ -3064,23 +3064,9 @@ namespace MWWorld
|
||||||
if (selectedCreature.empty())
|
if (selectedCreature.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ESM::Position ipos = mPlayer->getPlayer().getRefData().getPosition();
|
|
||||||
osg::Vec3f pos(ipos.asVec3());
|
|
||||||
osg::Quat rot(-ipos.rot[2], osg::Vec3f(0,0,1));
|
|
||||||
const float distance = 50;
|
|
||||||
pos = pos + (rot * osg::Vec3f(0,1,0)) * distance;
|
|
||||||
ipos.pos[0] = pos.x();
|
|
||||||
ipos.pos[1] = pos.y();
|
|
||||||
ipos.pos[2] = pos.z();
|
|
||||||
ipos.rot[0] = 0;
|
|
||||||
ipos.rot[1] = 0;
|
|
||||||
ipos.rot[2] = 0;
|
|
||||||
|
|
||||||
MWWorld::CellStore* cell = mPlayer->getPlayer().getCell();
|
|
||||||
MWWorld::ManualRef ref(getStore(), selectedCreature, 1);
|
MWWorld::ManualRef ref(getStore(), selectedCreature, 1);
|
||||||
ref.getPtr().getCellRef().setPosition(ipos);
|
|
||||||
|
|
||||||
placeObject(ref.getPtr(), cell, ipos);
|
safePlaceObject(ref.getPtr(), getPlayerPtr(), getPlayerPtr().getCell(), 0, 220.f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue