use degrees/sec for EntityItem angular velocity

This commit is contained in:
Andrew Meadows 2015-01-07 14:04:22 -08:00
parent af9bafae87
commit d2bd95703a

View file

@ -71,7 +71,8 @@ void EntityMotionState::setWorldTransform(const btTransform& worldTrans) {
_entity->setVelocityInMeters(v); _entity->setVelocityInMeters(v);
getAngularVelocity(v); getAngularVelocity(v);
_entity->setAngularVelocity(v); // DANGER! EntityItem stores angularVelocity in degrees/sec!!!
_entity->setAngularVelocity(glm::degrees(v));
_outgoingPacketFlags = DIRTY_PHYSICS_FLAGS; _outgoingPacketFlags = DIRTY_PHYSICS_FLAGS;
EntityMotionState::enqueueOutgoingEntity(_entity); EntityMotionState::enqueueOutgoingEntity(_entity);
@ -82,7 +83,8 @@ void EntityMotionState::applyVelocities() const {
#ifdef USE_BULLET_PHYSICS #ifdef USE_BULLET_PHYSICS
if (_body) { if (_body) {
setVelocity(_entity->getVelocityInMeters()); setVelocity(_entity->getVelocityInMeters());
setAngularVelocity(_entity->getAngularVelocity()); // DANGER! EntityItem stores angularVelocity in degrees/sec!!!
setAngularVelocity(glm::radians(_entity->getAngularVelocity()));
_body->setActivationState(ACTIVE_TAG); _body->setActivationState(ACTIVE_TAG);
} }
#endif // USE_BULLET_PHYSICS #endif // USE_BULLET_PHYSICS
@ -140,7 +142,8 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
properties.setVelocity(_sentVelocity); properties.setVelocity(_sentVelocity);
_sentAcceleration = bulletToGLM(_body->getGravity()); _sentAcceleration = bulletToGLM(_body->getGravity());
properties.setGravity(_sentAcceleration); properties.setGravity(_sentAcceleration);
properties.setAngularVelocity(_sentAngularVelocity); // DANGER! EntityItem stores angularVelocity in degrees/sec!!!
properties.setAngularVelocity(glm::degrees(_sentAngularVelocity));
} }
// RELIABLE_SEND_HACK: count number of updates for entities at rest so we can stop sending them after some limit. // RELIABLE_SEND_HACK: count number of updates for entities at rest so we can stop sending them after some limit.