mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 13:35:06 +02:00
update a motionstate's idea of what the entity-server thinks when an incoming update packet arrives
This commit is contained in:
parent
c63b8a93ec
commit
b0ccabe38e
3 changed files with 35 additions and 2 deletions
|
@ -47,6 +47,34 @@ EntityMotionState::~EntityMotionState() {
|
|||
assert(!_entity);
|
||||
}
|
||||
|
||||
void EntityMotionState::updateServerPhysicsVariables(uint32_t flags) {
|
||||
if (flags & EntityItem::DIRTY_POSITION) {
|
||||
_sentPosition = _entity->getPosition();
|
||||
}
|
||||
if (flags & EntityItem::DIRTY_ROTATION) {
|
||||
_sentRotation = _entity->getRotation();
|
||||
}
|
||||
if (flags & EntityItem::DIRTY_LINEAR_VELOCITY) {
|
||||
_sentVelocity = _entity->getVelocity();
|
||||
}
|
||||
if (flags & EntityItem::DIRTY_ANGULAR_VELOCITY) {
|
||||
_sentAngularVelocity = _entity->getAngularVelocity();
|
||||
}
|
||||
}
|
||||
|
||||
// virtual
|
||||
void EntityMotionState::handleEasyChanges(uint32_t flags) {
|
||||
updateServerPhysicsVariables(flags);
|
||||
ObjectMotionState::handleEasyChanges(flags);
|
||||
}
|
||||
|
||||
|
||||
// virtual
|
||||
void EntityMotionState::handleHardAndEasyChanges(uint32_t flags, PhysicsEngine* engine) {
|
||||
updateServerPhysicsVariables(flags);
|
||||
ObjectMotionState::handleHardAndEasyChanges(flags, engine);
|
||||
}
|
||||
|
||||
void EntityMotionState::clearEntity() {
|
||||
_entity = nullptr;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,10 @@ public:
|
|||
EntityMotionState(btCollisionShape* shape, EntityItem* item);
|
||||
virtual ~EntityMotionState();
|
||||
|
||||
void updateServerPhysicsVariables(uint32_t flags);
|
||||
virtual void handleEasyChanges(uint32_t flags);
|
||||
virtual void handleHardAndEasyChanges(uint32_t flags, PhysicsEngine* engine);
|
||||
|
||||
/// \return MOTION_TYPE_DYNAMIC or MOTION_TYPE_STATIC based on params set in EntityItem
|
||||
virtual MotionType computeObjectMotionType() const;
|
||||
|
||||
|
@ -88,6 +92,7 @@ protected:
|
|||
bool _sentMoving; // true if last update was moving
|
||||
int _numNonMovingUpdates; // RELIABLE_SEND_HACK for "not so reliable" resends of packets for non-moving objects
|
||||
|
||||
// TODO XXX rename _sent* to _server*
|
||||
uint32_t _sentStep;
|
||||
glm::vec3 _sentPosition; // in simulation-frame (not world-frame)
|
||||
glm::quat _sentRotation;;
|
||||
|
|
|
@ -68,8 +68,8 @@ public:
|
|||
ObjectMotionState(btCollisionShape* shape);
|
||||
~ObjectMotionState();
|
||||
|
||||
void handleEasyChanges(uint32_t flags);
|
||||
void handleHardAndEasyChanges(uint32_t flags, PhysicsEngine* engine);
|
||||
virtual void handleEasyChanges(uint32_t flags);
|
||||
virtual void handleHardAndEasyChanges(uint32_t flags, PhysicsEngine* engine);
|
||||
|
||||
virtual void updateBodyMaterialProperties();
|
||||
virtual void updateBodyVelocities();
|
||||
|
|
Loading…
Reference in a new issue