浏览代码

*** empty log message ***

David Rose 24 年之前
父节点
当前提交
982eea6f49
共有 1 个文件被更改,包括 8 次插入3 次删除
  1. 8 3
      direct/src/deadrec/smoothMover.cxx

+ 8 - 3
direct/src/deadrec/smoothMover.cxx

@@ -80,21 +80,26 @@ mark_position() {
     // With smoothing disabled, mark_position() simply stores its
     // With smoothing disabled, mark_position() simply stores its
     // current position in the smooth_position members.
     // current position in the smooth_position members.
 
 
+    // In this mode, we also ignore the supplied timestamp, and just
+    // use the current frame time--there's no need to risk trusting
+    // the timestamp from another client.
+    double timestamp = ClockObject::get_global_clock()->get_frame_time();
+
     // We also need to compute the velocity here.
     // We also need to compute the velocity here.
     if (_smooth_position_known) {
     if (_smooth_position_known) {
       LVector3f pos_delta = _sample._pos - _smooth_pos;
       LVector3f pos_delta = _sample._pos - _smooth_pos;
       LVecBase3f hpr_delta = _sample._hpr - _smooth_hpr;
       LVecBase3f hpr_delta = _sample._hpr - _smooth_hpr;
-      double age = _sample._timestamp - _smooth_timestamp;
+      double age = timestamp - _smooth_timestamp;
       age = min(age, _max_position_age);
       age = min(age, _max_position_age);
 
 
-      set_smooth_pos(_sample._pos, _sample._hpr, _sample._timestamp);
+      set_smooth_pos(_sample._pos, _sample._hpr, timestamp);
       if (age != 0.0) {
       if (age != 0.0) {
         compute_velocity(pos_delta, hpr_delta, age);
         compute_velocity(pos_delta, hpr_delta, age);
       }
       }
 
 
     } else {
     } else {
       // No velocity is possible, just position and orientation.
       // No velocity is possible, just position and orientation.
-      set_smooth_pos(_sample._pos, _sample._hpr, _sample._timestamp);
+      set_smooth_pos(_sample._pos, _sample._hpr, timestamp);
     }
     }
 
 
   } else {
   } else {