mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-09 21:42:13 +00:00
Clean up. But still a little hacky
This commit is contained in:
parent
5951abfae2
commit
48b3f1e0cf
@ -110,7 +110,7 @@ namespace MWWorld
|
||||
float remainingTime = time;
|
||||
bool isInterior = !ptr.getCell()->isExterior();
|
||||
Ogre::Vector3 halfExtents = physicActor->getHalfExtents();// + Vector3(1,1,1);
|
||||
physicActor->mBody->translate(btVector3(0,0,1000));
|
||||
physicActor->enableCollisions(false);
|
||||
|
||||
Ogre::Vector3 velocity;
|
||||
if(!gravity)
|
||||
@ -147,7 +147,6 @@ namespace MWWorld
|
||||
// trace to where character would go if there were no obstructions
|
||||
newtrace(&trace, newPosition, newPosition+clippedVelocity*remainingTime, halfExtents, isInterior, engine);
|
||||
newPosition = trace.endpos;
|
||||
//std::cout << newPosition.x << " ";
|
||||
remainingTime = remainingTime * (1.0f-trace.fraction);
|
||||
|
||||
// check for obstructions
|
||||
@ -191,8 +190,7 @@ namespace MWWorld
|
||||
}
|
||||
physicActor->setOnGround(onground);
|
||||
physicActor->setVerticalForce(!onground ? clippedVelocity.z - time*627.2f : 0.0f);
|
||||
physicActor->mBody->translate(btVector3(0,0,-1000));
|
||||
//std::cout << position.x << " " << newPosition.x << " " << position.y << " " << newPosition.y << std::endl;
|
||||
physicActor->enableCollisions(true);
|
||||
return newPosition;
|
||||
}
|
||||
};
|
||||
|
@ -37,6 +37,8 @@ namespace Physic
|
||||
Ogre::Quaternion inverse = mBoxRotation.Inverse();
|
||||
mBoxRotationInverse = btQuaternion(inverse.x, inverse.y, inverse.z,inverse.w);
|
||||
mEngine->addRigidBody(mBody, false); //Add rigid body to dynamics world, but do not add to object map
|
||||
//mBody->setCollisionFlags(COL_NOTHING);
|
||||
//mBody->setMas
|
||||
}
|
||||
|
||||
PhysicActor::~PhysicActor()
|
||||
@ -50,6 +52,8 @@ namespace Physic
|
||||
|
||||
void PhysicActor::enableCollisions(bool collision)
|
||||
{
|
||||
if(collision && !collisionMode) mBody->translate(btVector3(0,0,-1000));
|
||||
if(!collision && collisionMode) mBody->translate(btVector3(0,0,1000));
|
||||
collisionMode = collision;
|
||||
}
|
||||
|
||||
|
@ -129,10 +129,10 @@ namespace Physic
|
||||
void operator delete (void * Data) { _aligned_free (Data); }
|
||||
#endif
|
||||
|
||||
OEngine::Physic::RigidBody* mBody;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
OEngine::Physic::RigidBody* mBody;
|
||||
Ogre::Vector3 mBoxScaledTranslation;
|
||||
btQuaternion mBoxRotationInverse;
|
||||
Ogre::Quaternion mBoxRotation;
|
||||
|
Loading…
Reference in New Issue
Block a user