mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +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;
|
float remainingTime = time;
|
||||||
bool isInterior = !ptr.getCell()->isExterior();
|
bool isInterior = !ptr.getCell()->isExterior();
|
||||||
Ogre::Vector3 halfExtents = physicActor->getHalfExtents();// + Vector3(1,1,1);
|
Ogre::Vector3 halfExtents = physicActor->getHalfExtents();// + Vector3(1,1,1);
|
||||||
physicActor->mBody->translate(btVector3(0,0,1000));
|
physicActor->enableCollisions(false);
|
||||||
|
|
||||||
Ogre::Vector3 velocity;
|
Ogre::Vector3 velocity;
|
||||||
if(!gravity)
|
if(!gravity)
|
||||||
@ -147,7 +147,6 @@ namespace MWWorld
|
|||||||
// trace to where character would go if there were no obstructions
|
// trace to where character would go if there were no obstructions
|
||||||
newtrace(&trace, newPosition, newPosition+clippedVelocity*remainingTime, halfExtents, isInterior, engine);
|
newtrace(&trace, newPosition, newPosition+clippedVelocity*remainingTime, halfExtents, isInterior, engine);
|
||||||
newPosition = trace.endpos;
|
newPosition = trace.endpos;
|
||||||
//std::cout << newPosition.x << " ";
|
|
||||||
remainingTime = remainingTime * (1.0f-trace.fraction);
|
remainingTime = remainingTime * (1.0f-trace.fraction);
|
||||||
|
|
||||||
// check for obstructions
|
// check for obstructions
|
||||||
@ -191,8 +190,7 @@ namespace MWWorld
|
|||||||
}
|
}
|
||||||
physicActor->setOnGround(onground);
|
physicActor->setOnGround(onground);
|
||||||
physicActor->setVerticalForce(!onground ? clippedVelocity.z - time*627.2f : 0.0f);
|
physicActor->setVerticalForce(!onground ? clippedVelocity.z - time*627.2f : 0.0f);
|
||||||
physicActor->mBody->translate(btVector3(0,0,-1000));
|
physicActor->enableCollisions(true);
|
||||||
//std::cout << position.x << " " << newPosition.x << " " << position.y << " " << newPosition.y << std::endl;
|
|
||||||
return newPosition;
|
return newPosition;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -37,6 +37,8 @@ namespace Physic
|
|||||||
Ogre::Quaternion inverse = mBoxRotation.Inverse();
|
Ogre::Quaternion inverse = mBoxRotation.Inverse();
|
||||||
mBoxRotationInverse = btQuaternion(inverse.x, inverse.y, inverse.z,inverse.w);
|
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
|
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()
|
PhysicActor::~PhysicActor()
|
||||||
@ -50,6 +52,8 @@ namespace Physic
|
|||||||
|
|
||||||
void PhysicActor::enableCollisions(bool collision)
|
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;
|
collisionMode = collision;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,10 +129,10 @@ namespace Physic
|
|||||||
void operator delete (void * Data) { _aligned_free (Data); }
|
void operator delete (void * Data) { _aligned_free (Data); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OEngine::Physic::RigidBody* mBody;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
OEngine::Physic::RigidBody* mBody;
|
||||||
Ogre::Vector3 mBoxScaledTranslation;
|
Ogre::Vector3 mBoxScaledTranslation;
|
||||||
btQuaternion mBoxRotationInverse;
|
btQuaternion mBoxRotationInverse;
|
||||||
Ogre::Quaternion mBoxRotation;
|
Ogre::Quaternion mBoxRotation;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user