mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-09 21:44:54 +00:00
Revert "Take in account actor half extents for obstacle check"
This reverts commit 5434e924375ae878124aaab1b3353a1781b4ed8a.
This commit is contained in:
parent
f7917964a0
commit
7b94183d83
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
#include <components/sceneutil/positionattitudetransform.hpp>
|
#include <components/sceneutil/positionattitudetransform.hpp>
|
||||||
|
|
||||||
#include "../mwbase/world.hpp"
|
|
||||||
#include "../mwbase/environment.hpp"
|
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
|
|
||||||
@ -125,17 +123,15 @@ namespace MWMechanics
|
|||||||
*/
|
*/
|
||||||
void ObstacleCheck::update(const MWWorld::Ptr& actor, float duration)
|
void ObstacleCheck::update(const MWWorld::Ptr& actor, float duration)
|
||||||
{
|
{
|
||||||
const ESM::Position pos = actor.getRefData().getPosition();
|
const MWWorld::Class& cls = actor.getClass();
|
||||||
|
ESM::Position pos = actor.getRefData().getPosition();
|
||||||
|
|
||||||
if (mDistSameSpot == -1)
|
if(mDistSameSpot == -1)
|
||||||
{
|
mDistSameSpot = DIST_SAME_SPOT * cls.getSpeed(actor);
|
||||||
const osg::Vec3f halfExtents = MWBase::Environment::get().getWorld()->getHalfExtents(actor);
|
|
||||||
mDistSameSpot = DIST_SAME_SPOT * actor.getClass().getSpeed(actor) + 1.2 * std::max(halfExtents.x(), halfExtents.y());
|
|
||||||
}
|
|
||||||
|
|
||||||
const float distSameSpot = mDistSameSpot * duration;
|
float distSameSpot = mDistSameSpot * duration;
|
||||||
const float squaredMovedDistance = (osg::Vec2f(pos.pos[0], pos.pos[1]) - osg::Vec2f(mPrevX, mPrevY)).length2();
|
|
||||||
const bool samePosition = squaredMovedDistance < distSameSpot * distSameSpot;
|
bool samePosition = (osg::Vec2f(pos.pos[0], pos.pos[1]) - osg::Vec2f(mPrevX, mPrevY)).length2() < distSameSpot * distSameSpot;
|
||||||
|
|
||||||
// update position
|
// update position
|
||||||
mPrevX = pos.pos[0];
|
mPrevX = pos.pos[0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user