mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
rename to measureAcceleration
This commit is contained in:
parent
1acb90e23a
commit
619d1ba191
4 changed files with 8 additions and 8 deletions
|
@ -62,7 +62,7 @@ void EntityMotionState::stepKinematicSimulation(quint64 now) {
|
|||
// which is different from physical kinematic motion (inside getWorldTransform())
|
||||
// which steps in physics simulation time.
|
||||
_entity->simulate(now);
|
||||
// TODO: we can't use ObjectMotionState::measureVelocityAndAcceleration() here because the entity
|
||||
// TODO: we can't use ObjectMotionState::measureAcceleration() here because the entity
|
||||
// has no RigidBody and the timestep is a little bit out of sync with the physics simulation anyway.
|
||||
// Hence we must manually measure kinematic velocity and acceleration.
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ void EntityMotionState::getWorldTransform(btTransform& worldTrans) const {
|
|||
// This callback is invoked by the physics simulation at the end of each simulation step...
|
||||
// iff the corresponding RigidBody is DYNAMIC and has moved.
|
||||
void EntityMotionState::setWorldTransform(const btTransform& worldTrans) {
|
||||
measureVelocityAndAcceleration();
|
||||
measureAcceleration();
|
||||
_entity->setPosition(bulletToGLM(worldTrans.getOrigin()) + ObjectMotionState::getWorldOffset());
|
||||
_entity->setRotation(bulletToGLM(worldTrans.getRotation()));
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ ObjectMotionState::~ObjectMotionState() {
|
|||
assert(_body == NULL);
|
||||
}
|
||||
|
||||
void ObjectMotionState::measureVelocityAndAcceleration() {
|
||||
void ObjectMotionState::measureAcceleration() {
|
||||
// try to manually measure the true acceleration of the object
|
||||
uint32_t numSubsteps = _simulationStep - _lastSimulationStep;
|
||||
if (numSubsteps > 0) {
|
||||
|
@ -84,7 +84,7 @@ void ObjectMotionState::measureVelocityAndAcceleration() {
|
|||
}
|
||||
}
|
||||
|
||||
void ObjectMotionState::resetMeasuredVelocityAndAcceleration() {
|
||||
void ObjectMotionState::resetMeasuredAcceleration() {
|
||||
_lastSimulationStep = _simulationStep;
|
||||
_lastVelocity = bulletToGLM(_body->getLinearVelocity());
|
||||
}
|
||||
|
|
|
@ -62,8 +62,8 @@ public:
|
|||
ObjectMotionState();
|
||||
~ObjectMotionState();
|
||||
|
||||
void measureVelocityAndAcceleration();
|
||||
void resetMeasuredVelocityAndAcceleration();
|
||||
void measureAcceleration();
|
||||
void resetMeasuredAcceleration();
|
||||
|
||||
// An EASY update does not require the object to be removed and then reinserted into the PhysicsEngine
|
||||
virtual void updateObjectEasy(uint32_t flags, uint32_t frame) = 0;
|
||||
|
|
|
@ -194,7 +194,7 @@ void PhysicsEngine::relayIncomingChangesToSimulation() {
|
|||
motionState->updateObjectEasy(flags, _numSubsteps);
|
||||
}
|
||||
if (flags & (EntityItem::DIRTY_POSITION | EntityItem::DIRTY_VELOCITY)) {
|
||||
motionState->resetMeasuredVelocityAndAcceleration();
|
||||
motionState->resetMeasuredAcceleration();
|
||||
}
|
||||
} else {
|
||||
// the only way we should ever get here (motionState exists but no body) is when the object
|
||||
|
@ -511,7 +511,7 @@ void PhysicsEngine::addObject(const ShapeInfo& shapeInfo, btCollisionShape* shap
|
|||
body->setFriction(motionState->_friction);
|
||||
body->setDamping(motionState->_linearDamping, motionState->_angularDamping);
|
||||
_dynamicsWorld->addRigidBody(body);
|
||||
motionState->resetMeasuredVelocityAndAcceleration();
|
||||
motionState->resetMeasuredAcceleration();
|
||||
}
|
||||
|
||||
void PhysicsEngine::removeObjectFromBullet(ObjectMotionState* motionState) {
|
||||
|
|
Loading…
Reference in a new issue