update ALL parameters of remote physics simulation

This commit is contained in:
Andrew Meadows 2015-06-01 09:02:59 -07:00
parent 396a20c72d
commit 2400f5c000
2 changed files with 9 additions and 16 deletions

View file

@ -49,24 +49,17 @@ EntityMotionState::~EntityMotionState() {
assert(!_entity); assert(!_entity);
} }
void EntityMotionState::updateServerPhysicsVariables(uint32_t flags) { void EntityMotionState::updateServerPhysicsVariables() {
if (flags & EntityItem::DIRTY_POSITION) { _serverPosition = _entity->getPosition();
_serverPosition = _entity->getPosition(); _serverRotation = _entity->getRotation();
} _serverVelocity = _entity->getVelocity();
if (flags & EntityItem::DIRTY_ROTATION) { _serverAngularVelocity = _entity->getAngularVelocity();
_serverRotation = _entity->getRotation(); _serverAcceleration = _entity->getAcceleration();
}
if (flags & EntityItem::DIRTY_LINEAR_VELOCITY) {
_serverVelocity = _entity->getVelocity();
}
if (flags & EntityItem::DIRTY_ANGULAR_VELOCITY) {
_serverAngularVelocity = _entity->getAngularVelocity();
}
} }
// virtual // virtual
void EntityMotionState::handleEasyChanges(uint32_t flags) { void EntityMotionState::handleEasyChanges(uint32_t flags) {
updateServerPhysicsVariables(flags); updateServerPhysicsVariables();
ObjectMotionState::handleEasyChanges(flags); ObjectMotionState::handleEasyChanges(flags);
if (flags & EntityItem::DIRTY_SIMULATOR_ID) { if (flags & EntityItem::DIRTY_SIMULATOR_ID) {
_loopsWithoutOwner = 0; _loopsWithoutOwner = 0;
@ -94,7 +87,7 @@ void EntityMotionState::handleEasyChanges(uint32_t flags) {
// virtual // virtual
void EntityMotionState::handleHardAndEasyChanges(uint32_t flags, PhysicsEngine* engine) { void EntityMotionState::handleHardAndEasyChanges(uint32_t flags, PhysicsEngine* engine) {
updateServerPhysicsVariables(flags); updateServerPhysicsVariables();
ObjectMotionState::handleHardAndEasyChanges(flags, engine); ObjectMotionState::handleHardAndEasyChanges(flags, engine);
} }

View file

@ -28,7 +28,7 @@ public:
EntityMotionState(btCollisionShape* shape, EntityItemPointer item); EntityMotionState(btCollisionShape* shape, EntityItemPointer item);
virtual ~EntityMotionState(); virtual ~EntityMotionState();
void updateServerPhysicsVariables(uint32_t flags); void updateServerPhysicsVariables();
virtual void handleEasyChanges(uint32_t flags); virtual void handleEasyChanges(uint32_t flags);
virtual void handleHardAndEasyChanges(uint32_t flags, PhysicsEngine* engine); virtual void handleHardAndEasyChanges(uint32_t flags, PhysicsEngine* engine);