From 3645b3357e224db2a5e52c1d91f8f0e7afa68017 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 2 Jun 2016 21:24:19 +0200 Subject: [PATCH] Fix improper assignement of spawn point in placeAt for non-actors (Bug #3417) --- apps/openmw/mwworld/worldimp.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 22a8daa9bf..cb6f8b195b 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1326,10 +1326,11 @@ namespace MWWorld int fallbackDirections[4] = {direction, (direction+3)%4, (direction+2)%4, (direction+1)%4}; + osg::Vec3f spawnPoint = pos; + for (int i=0; i<4; ++i) { direction = fallbackDirections[i]; - osg::Vec3f spawnPoint = pos; if (direction == 0) spawnPoint = pos + (orientation * osg::Vec3f(0,1,0)) * distance; else if(direction == 1) spawnPoint = pos - (orientation * osg::Vec3f(0,1,0)) * distance; else if(direction == 2) spawnPoint = pos - (orientation * osg::Vec3f(1,0,0)) * distance; @@ -1345,12 +1346,12 @@ namespace MWWorld pos.x(), pos.y(), pos.z() + 20)) { // safe - ipos.pos[0] = spawnPoint.x(); - ipos.pos[1] = spawnPoint.y(); - ipos.pos[2] = spawnPoint.z(); break; } } + ipos.pos[0] = spawnPoint.x(); + ipos.pos[1] = spawnPoint.y(); + ipos.pos[2] = spawnPoint.z(); if (!referenceObject.getClass().isActor()) {