|
|
|
@ -683,6 +683,7 @@ namespace MWPhysics
|
|
|
|
|
, mWaterEnabled(false)
|
|
|
|
|
, mParentNode(parentNode)
|
|
|
|
|
, mPhysicsDt(1.f / 60.f)
|
|
|
|
|
, mIdleUpdateTimer(0)
|
|
|
|
|
{
|
|
|
|
|
mResourceSystem->addResourceManager(mShapeManager.get());
|
|
|
|
|
|
|
|
|
@ -739,6 +740,18 @@ namespace MWPhysics
|
|
|
|
|
delete mBroadphase;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PhysicsSystem::updateIdle()
|
|
|
|
|
{
|
|
|
|
|
for (ActorMap::iterator it = mActors.begin(); it != mActors.end(); ++it)
|
|
|
|
|
{
|
|
|
|
|
osg::Vec3f pos(it->second->getCollisionObjectPosition());
|
|
|
|
|
|
|
|
|
|
RayResult result = castRay(pos, pos - osg::Vec3f(0, 0, it->second->getHalfExtents().z() + 2), it->second->getPtr(), std::vector<MWWorld::Ptr>(), CollisionType_World|CollisionType_HeightMap|CollisionType_Door);
|
|
|
|
|
|
|
|
|
|
it->second->setIdle(result.mHit);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PhysicsSystem::setUnrefQueue(SceneUtil::UnrefQueue *unrefQueue)
|
|
|
|
|
{
|
|
|
|
|
mUnrefQueue = unrefQueue;
|
|
|
|
@ -1045,6 +1058,11 @@ namespace MWPhysics
|
|
|
|
|
return physactor && physactor->getOnGround();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool PhysicsSystem::isIdle(const MWWorld::Ptr &actor)
|
|
|
|
|
{
|
|
|
|
|
Actor* physactor = getActor(actor);
|
|
|
|
|
return physactor && physactor->getIdle();
|
|
|
|
|
}
|
|
|
|
|
bool PhysicsSystem::canMoveToWaterSurface(const MWWorld::ConstPtr &actor, const float waterlevel)
|
|
|
|
|
{
|
|
|
|
|
const Actor* physicActor = getActor(actor);
|
|
|
|
@ -1337,6 +1355,10 @@ namespace MWPhysics
|
|
|
|
|
cmode = !cmode;
|
|
|
|
|
found->second->enableCollisionMode(cmode);
|
|
|
|
|
found->second->enableCollisionBody(cmode);
|
|
|
|
|
|
|
|
|
|
if (cmode)
|
|
|
|
|
queueObjectMovement(MWMechanics::getPlayer(), osg::Vec3f(0, 0, -0.1f));
|
|
|
|
|
|
|
|
|
|
return cmode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1456,6 +1478,13 @@ namespace MWPhysics
|
|
|
|
|
for (std::set<Object*>::iterator it = mAnimatedObjects.begin(); it != mAnimatedObjects.end(); ++it)
|
|
|
|
|
(*it)->animateCollisionShapes(mCollisionWorld);
|
|
|
|
|
|
|
|
|
|
mIdleUpdateTimer -= dt;
|
|
|
|
|
if (mIdleUpdateTimer <= 0.f)
|
|
|
|
|
{
|
|
|
|
|
mIdleUpdateTimer = 0.5f;
|
|
|
|
|
updateIdle();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifndef BT_NO_PROFILE
|
|
|
|
|
CProfileManager::Reset();
|
|
|
|
|
CProfileManager::Increment_Frame_Counter();
|
|
|
|
|