mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 16:15:31 +00:00
hacky solution with debug; seems that player is added before cell so tracing down will not find anything
This commit is contained in:
parent
19ad7d7f0c
commit
1479f98793
2 changed files with 18 additions and 1 deletions
|
@ -72,7 +72,6 @@ Actor::Actor(const MWWorld::Ptr& ptr, const Resource::BulletShape* shape, Physic
|
||||||
updatePosition();
|
updatePosition();
|
||||||
addCollisionMask(getCollisionMask());
|
addCollisionMask(getCollisionMask());
|
||||||
updateCollisionObjectPosition();
|
updateCollisionObjectPosition();
|
||||||
mOnGround.store(false, std::memory_order_release);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Actor::~Actor()
|
Actor::~Actor()
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <LinearMath/btIDebugDraw.h>
|
#include <LinearMath/btIDebugDraw.h>
|
||||||
#include <LinearMath/btVector3.h>
|
#include <LinearMath/btVector3.h>
|
||||||
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <osg/Group>
|
#include <osg/Group>
|
||||||
#include <osg/Stats>
|
#include <osg/Stats>
|
||||||
|
@ -680,7 +681,24 @@ namespace MWPhysics
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto actor = std::make_shared<Actor>(ptr, shape, mTaskScheduler.get());
|
auto actor = std::make_shared<Actor>(ptr, shape, mTaskScheduler.get());
|
||||||
|
|
||||||
|
if (ptr == MWMechanics::getPlayer())
|
||||||
|
{
|
||||||
|
osg::Vec3f offset = actor->getCollisionObjectPosition() - ptr.getRefData().getPosition().asVec3();
|
||||||
|
std::cout << "DEBUG Player position: " << actor->getPosition() << std::endl;
|
||||||
|
auto terrainHeight = std::max(0.f, MWBase::Environment::get().getWorld()->getTerrainHeightAt(actor->getPosition()));
|
||||||
|
std::cout << "DEBUG terrain height " << terrainHeight << std::endl;
|
||||||
|
ActorTracer tracer;
|
||||||
|
tracer.findGround(actor.get(), actor->getPosition() + offset, actor->getPosition() + offset - osg::Vec3f(0, 0, 100.f), mCollisionWorld.get());
|
||||||
|
std::cout << "DEBUG mFraction " << tracer.mFraction << std::endl; // it seems that player is loaded before the cell so we can't find the ground.
|
||||||
|
|
||||||
|
std::cout << "DEBUG calculation :: " << actor->getPosition().z() - terrainHeight << std::endl;
|
||||||
|
if (actor->getPosition().z() - terrainHeight > 300.f)
|
||||||
|
actor->setOnGround(false);
|
||||||
|
}
|
||||||
|
|
||||||
mActors.emplace(ptr, std::move(actor));
|
mActors.emplace(ptr, std::move(actor));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int PhysicsSystem::addProjectile (const MWWorld::Ptr& caster, const osg::Vec3f& position, const std::string& mesh, bool computeRadius, bool canTraverseWater)
|
int PhysicsSystem::addProjectile (const MWWorld::Ptr& caster, const osg::Vec3f& position, const std::string& mesh, bool computeRadius, bool canTraverseWater)
|
||||||
|
|
Loading…
Reference in a new issue