Panda3D

smoothMover.I
Go to the documentation of this file.
1 /**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file smoothMover.I
10 * @author drose
11 * @date 2001-10-19
12 */
13
14 /**
15 * Specifies the position of the SmoothMover at a particular time in the past.
16 * When mark_position() is called, this will be recorded (along with hpr and
17 * timestamp) in a position report, which will then be used along with all
18 * other position reports to determine the smooth position at any particular
19 * instant.
20 *
21 * The return value is true if any parameter has changed since the last call
22 * to set_pos(), or false if they are the same.
23 */
24 INLINE bool SmoothMover::
25 set_pos(const LVecBase3 &pos) {
26 return set_x(pos[0]) | set_y(pos[1]) | set_z(pos[2]);
27 }
28
29 /**
30 * Specifies the position of the SmoothMover at a particular time in the past.
31 * When mark_position() is called, this will be recorded (along with hpr and
32 * timestamp) in a position report, which will then be used along with all
33 * other position reports to determine the smooth position at any particular
34 * instant.
35 *
36 * The return value is true if any parameter has changed since the last call
37 * to set_pos(), or false if they are the same.
38 */
39 INLINE bool SmoothMover::
40 set_pos(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) {
41 return set_x(x) | set_y(y) | set_z(z);
42 }
43
44 /**
45 * Sets the X position only. See set_pos().
46 */
47 INLINE bool SmoothMover::
48 set_x(PN_stdfloat x) {
49 bool result = (x != _sample._pos[0]);
50 /*
51 if (deadrec_cat.is_debug()) {
52 deadrec_cat.debug() << "set_x " << x << "\n";
53 }
54 */
55 _sample._pos[0] = x;
56 return result;
57 }
58
59 /**
60 * Sets the Y position only. See set_pos().
61 */
62 INLINE bool SmoothMover::
63 set_y(PN_stdfloat y) {
64 bool result = (y != _sample._pos[1]);
65 /*
66 if (deadrec_cat.is_debug()) {
67 deadrec_cat.debug() << "set_y " << y << "\n";
68 }
69 */
70 _sample._pos[1] = y;
71 return result;
72 }
73
74 /**
75 * Sets the Z position only. See set_pos().
76 */
77 INLINE bool SmoothMover::
78 set_z(PN_stdfloat z) {
79 bool result = (z != _sample._pos[2]);
80 /*
81 if (deadrec_cat.is_debug()) {
82 deadrec_cat.debug() << "set_z " << z << "\n";
83 }
84 */
85 _sample._pos[2] = z;
86 return result;
87 }
88
89 /**
90 * Specifies the orientation of the SmoothMover at a particular time in the
91 * past. When mark_position() is called, this will be recorded (along with
92 * hpr and timestamp) in a position report, which will then be used along with
93 * all other position reports to determine the smooth position at any
94 * particular instant.
95 *
96 * The return value is true if any parameter has changed since the last call
97 * to set_hpr(), or false if they are the same.
98 */
99 INLINE bool SmoothMover::
100 set_hpr(const LVecBase3 &hpr) {
101 return set_h(hpr[0]) | set_p(hpr[1]) | set_r(hpr[2]);
102 }
103
104 /**
105 * Specifies the orientation of the SmoothMover at a particular time in the
106 * past. When mark_position() is called, this will be recorded (along with
107 * hpr and timestamp) in a position report, which will then be used along with
108 * all other position reports to determine the smooth position at any
109 * particular instant.
110 *
111 * The return value is true if any parameter has changed since the last call
112 * to set_hpr(), or false if they are the same.
113 */
114 INLINE bool SmoothMover::
115 set_hpr(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) {
116 return set_h(h) | set_p(p) | set_r(r);
117 }
118
119 /**
120 * Sets the heading only. See set_hpr().
121 */
122 INLINE bool SmoothMover::
123 set_h(PN_stdfloat h) {
124 bool result = (h != _sample._hpr[0]);
125 /*
126 if (deadrec_cat.is_debug()) {
127 deadrec_cat.debug() << "set_h " << h << "\n";
128 }
129 */
130 _sample._hpr[0] = h;
131 return result;
132 }
133
134 /**
135 * Sets the pitch only. See set_hpr().
136 */
137 INLINE bool SmoothMover::
138 set_p(PN_stdfloat p) {
139 bool result = (p != _sample._hpr[1]);
140 /*
141 if (deadrec_cat.is_debug()) {
142 deadrec_cat.debug() << "set_p " << p << "\n";
143 }
144 */
145 _sample._hpr[1] = p;
146 return result;
147 }
148
149 /**
150 * Sets the roll only. See set_hpr().
151 */
152 INLINE bool SmoothMover::
153 set_r(PN_stdfloat r) {
154 bool result = (r != _sample._hpr[2]);
155 /*
156 if (deadrec_cat.is_debug()) {
157 deadrec_cat.debug() << "set_r " << r << "\n";
158 }
159 */
160 _sample._hpr[2] = r;
161 return result;
162 }
163
164 /**
165 * Specifies the position and orientation of the SmoothMover at a particular
166 * time in the past. When mark_position() is called, this will be recorded
167 * (along with timestamp) in a position report, which will then be used along
168 * with all other position reports to determine the smooth position at any
169 * particular instant.
170 *
171 * The return value is true if any parameter has changed since the last call
172 * to set_pos_hpr(), or false if they are the same.
173 */
174 INLINE bool SmoothMover::
175 set_pos_hpr(const LVecBase3 &pos, const LVecBase3 &hpr) {
176 return (set_x(pos[0]) | set_y(pos[1]) | set_z(pos[2]) |
177 set_h(hpr[0]) | set_p(hpr[1]) | set_r(hpr[2]));
178 }
179
180 /**
181 * Specifies the position of the SmoothMover at a particular time in the past.
182 * When mark_position() is called, this will be recorded (along with
183 * timestamp) in a position report, which will then be used along with all
184 * other position reports to determine the smooth position at any particular
185 * instant.
186 *
187 * The return value is true if any parameter has changed since the last call
188 * to set_pos_hpr(), or false if they are the same.
189 */
190 INLINE bool SmoothMover::
191 set_pos_hpr(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) {
192 return set_x(x) | set_y(y) | set_z(z) | set_h(h) | set_p(p) | set_r(r);
193 }
194
195 /**
196 * Returns the current position of the working sample point. This position is
197 * updated periodically by set_x(), set_y(), etc., and its current value is
198 * copied to the sample point table when mark_position() is called.
199 */
200 INLINE const LPoint3 &SmoothMover::
201 get_sample_pos() const {
202 return _sample._pos;
203 }
204
205 /**
206 * Returns the current orientation of the working sample point. This
207 * orientation is updated periodically by set_h(), set_p(), etc., and its
208 * current value is copied to the sample point table when mark_position() is
209 * called.
210 */
211 INLINE const LVecBase3 &SmoothMover::
212 get_sample_hpr() const {
213 return _sample._hpr;
214 }
215
216 /**
217 * Lies and specifies that the current position report was received now. This
218 * is usually used for very old position reports for which we're not sure of
219 * the actual receipt time.
220 */
221 INLINE void SmoothMover::
222 set_phony_timestamp(double timestamp, bool period_adjust) {
223 double now = ClockObject::get_global_clock()->get_frame_time();
224 if (timestamp != 0.0)
225 // we were given a specific timestamp to use
226 now = timestamp;
227
228 // adjust by _delay when creating the timestamp since other timestamps
229 // received from network updates are adjusted by this
230 if (period_adjust) {
231 _sample._timestamp = now - _expected_broadcast_period;
232 }
233 else
234 _sample._timestamp = now;
235
236 _has_most_recent_timestamp = true;
237 _most_recent_timestamp = _sample._timestamp;
238
239 }
240
241 /**
242 * Specifies the time that the current position report applies. This should
243 * be called, along with set_pos() and set_hpr(), before a call to
244 * mark_position().
245 */
246 INLINE void SmoothMover::
247 set_timestamp(double timestamp) {
248 /*
249 if (deadrec_cat.is_debug()) {
250 deadrec_cat.debug() << "set_timestamp " << timestamp << "\n";
251 }
252 */
253 _sample._timestamp = timestamp;
254 _has_most_recent_timestamp = true;
255 _most_recent_timestamp = timestamp;
256 record_timestamp_delay(timestamp);
257 }
258
259 /**
260 * Returns true if we have most recently recorded timestamp
261 */
262 INLINE bool SmoothMover::
263 has_most_recent_timestamp() const {
264 return _has_most_recent_timestamp;
265 }
266
267 /**
268 * Returns most recently recorded timestamp
269 */
270 INLINE double SmoothMover::
271 get_most_recent_timestamp() const {
272 return _most_recent_timestamp;
273 }
274
275 /**
276 * Computes the smoothed position (and orientation) of the mover at the
277 * indicated point in time, based on the previous position reports. After
278 * this call has been made, get_smooth_pos() etc. may be called to retrieve
279 * the smoothed position.
280 *
281 * With no parameter, the function uses ClockObject::get_frame_time() as the
282 * default time.
283 */
284 INLINE bool SmoothMover::
285 compute_smooth_position() {
286 return compute_smooth_position(ClockObject::get_global_clock()->get_frame_time());
287 }
288
289 /**
290 * Returns the smoothed position as computed by a previous call to
291 * compute_smooth_position().
292 */
293 INLINE const LPoint3 &SmoothMover::
294 get_smooth_pos() const {
295 return _smooth_pos;
296 }
297
298 /**
299 * Returns the smoothed position as computed by a previous call to
300 * compute_smooth_position().
301 */
302 INLINE const LVecBase3 &SmoothMover::
303 get_forward_axis() const {
304 return _forward_axis;
305 }
306
307 /**
308 * Returns the smoothed orientation as computed by a previous call to
309 * compute_smooth_position().
310 */
311 INLINE const LVecBase3 &SmoothMover::
312 get_smooth_hpr() const {
313 return _smooth_hpr;
314 }
315
316 /**
317 * Applies the smoothed position to the indicated NodePath. This is
318 * equivalent to calling node.set_pos(smooth_mover->get_smooth_pos()). It
319 * exists as an optimization only, to avoid the overhead of passing the return
320 * value through Python.
321 */
322 INLINE void SmoothMover::
323 apply_smooth_pos(NodePath &node) const {
324 node.set_pos(get_smooth_pos());
325 }
326
327 /**
328 * Applies the smoothed position and orientation to the indicated NodePath.
329 * This is equivalent to calling
330 * node.set_pos_hpr(smooth_mover->get_smooth_pos(),
331 * smooth_mover->get_smooth_hpr()). It exists as an optimization only, to
332 * avoid the overhead of passing the return value through Python.
333 */
334 INLINE void SmoothMover::
335 apply_smooth_pos_hpr(NodePath &pos_node, NodePath &hpr_node) const {
336 pos_node.set_pos(get_smooth_pos());
337 hpr_node.set_hpr(get_smooth_hpr());
338 }
339
340 /**
341 * Applies the smoothed orientation to the indicated NodePath. This is
342 * equivalent to calling node.set_hpr(smooth_mover->get_smooth_hpr()). It
343 * exists as an optimization only, to avoid the overhead of passing the return
344 * value through Python.
345 */
346 INLINE void SmoothMover::
347 apply_smooth_hpr(NodePath &node) const {
348 node.set_hpr(get_smooth_hpr());
349 }
350
351 /**
352 * A further optimization to reduce Python calls. This computes the smooth
353 * position and applies it to the indicated node in one call.
354 */
355 INLINE void SmoothMover::
356 compute_and_apply_smooth_pos(NodePath &node) {
357 if (compute_smooth_position()) {
358 apply_smooth_pos(node);
359 }
360 }
361
362 /**
363 * A further optimization to reduce Python calls. This computes the smooth
364 * position and applies it to the indicated node or nodes in one call. The
365 * pos_node and hpr_node might be the same NodePath.
366 */
367 INLINE void SmoothMover::
368 compute_and_apply_smooth_pos_hpr(NodePath &pos_node, NodePath &hpr_node) {
369 if (compute_smooth_position()) {
370 apply_smooth_pos(pos_node);
371 apply_smooth_hpr(hpr_node);
372 }
373 }
374
375 /**
376 * A further optimization to reduce Python calls. This computes the smooth
377 * position and applies it to the indicated node or nodes in one call. The
378 * pos_node and hpr_node might be the same NodePath.
379 */
380 INLINE void SmoothMover::
381 compute_and_apply_smooth_hpr(NodePath &hpr_node) {
382 if (compute_smooth_position()) {
383 apply_smooth_hpr(hpr_node);
384 }
385 }
386
387 /**
388 * Returns the speed at which the avatar is moving, in feet per second, along
389 * its own forward axis (after applying the avatar's hpr). This will be a
390 * positive number if the avatar is moving forward, and a negative number if
391 * it is moving backward.
392 */
393 INLINE PN_stdfloat SmoothMover::
394 get_smooth_forward_velocity() const {
395 return _smooth_forward_velocity;
396 }
397
398 /**
399 * Returns the speed at which the avatar is moving, in feet per second, along
400 * its own lateral axis (after applying the avatar's hpr). This will be a
401 * positive number if the avatar is moving right, and a negative number if it
402 * is moving left.
403 */
404 INLINE PN_stdfloat SmoothMover::
405 get_smooth_lateral_velocity() const {
406 return _smooth_lateral_velocity;
407 }
408
409 /**
410 * Returns the speed at which the avatar is rotating in the horizontal plane
411 * (i.e. heading), in degrees per second. This may be positive or negative,
412 * according to the direction of rotation.
413 */
414 INLINE PN_stdfloat SmoothMover::
415 get_smooth_rotational_velocity() const {
416 return _smooth_rotational_velocity;
417 }
418
419 /**
420 * Sets the smoothing mode of all SmoothMovers in the world. If this is
421 * SM_off, no smoothing or prediction will be performed, and get_smooth_pos()
422 * will simply return the position last set by mark_position().
423 */
424 INLINE void SmoothMover::
425 set_smooth_mode(SmoothMover::SmoothMode mode) {
426 _smooth_mode = mode;
427 }
428
429 /**
430 * Returns the smoothing mode of all SmoothMovers in the world. See
431 * set_smooth_mode().
432 */
433 INLINE SmoothMover::SmoothMode SmoothMover::
434 get_smooth_mode() {
435 return _smooth_mode;
436 }
437
438 /**
439 * Sets the predictioning mode of all SmoothMovers in the world. If this is
440 * PM_off, no prediction will be performed, but smoothing might still be
441 * performed.
442 */
443 INLINE void SmoothMover::
444 set_prediction_mode(SmoothMover::PredictionMode mode) {
445 _prediction_mode = mode;
446 }
447
448 /**
449 * Returns the predictioning mode of all SmoothMovers in the world. See
450 * set_prediction_mode().
451 */
452 INLINE SmoothMover::PredictionMode SmoothMover::
453 get_prediction_mode() {
454 return _prediction_mode;
455 }
456
457 /**
458 * Sets the amount of time, in seconds, to delay the computed position of a
459 * SmoothMover. This is particularly useful when the prediction mode is off,
460 * because it can allow the apparent motion of an avatar to appear smooth
461 * without relying on prediction, at the cost of introducing additional lag in
462 * the avatar's apparent position.
463 */
464 INLINE void SmoothMover::
465 set_delay(double delay) {
466 _delay = delay;
467 }
468
469 /**
470 * Returns the amount of time, in seconds, to delay the computed position of a
471 * SmoothMover. See set_delay().
472 */
473 INLINE double SmoothMover::
474 get_delay() {
475 return _delay;
476 }
477
478 /**
479 * Sets the 'accept clock skew' flag. When this flag is true, clock skew from
480 * the other clients will be tolerated by delaying each smooth mover's
481 * position an additional amount, on top of that specified by set_delay(),
482 * based on the measured average latency for timestamp messages received by
483 * the client.
484 *
485 * In this way, if the other client has significant clock skew with respect to
486 * our clock, it will be evident as a large positive or negative average
487 * latency for timestamps. By subtracting out this average latency, we
488 * compensate for poor clock sync.
489 */
490 INLINE void SmoothMover::
491 set_accept_clock_skew(bool flag) {
492 _accept_clock_skew = flag;
493 }
494
495 /**
496 * Returns the current state of the 'accept clock skew' flag. See
497 * set_accept_clock_skew().
498 */
499 INLINE bool SmoothMover::
500 get_accept_clock_skew() {
501 return _accept_clock_skew;
502 }
503
504 /**
505 * Sets the maximum amount of time a position is allowed to remain unchanged
506 * before assuming it represents the avatar actually standing still.
507 */
508 INLINE void SmoothMover::
509 set_max_position_age(double age) {
510 _max_position_age = age;
511 }
512
513 /**
514 * Returns the maximum amount of time a position is allowed to remain
515 * unchanged before assuming it represents the avatar actually standing still.
516 */
517 INLINE double SmoothMover::
518 get_max_position_age() {
519 return _max_position_age;
520 }
521
522 /**
523 * Sets the interval at which we expect the SmoothNodes to broadcast their
524 * position, in elapsed seconds. This controls the length of time we assume
525 * the object has truly stopped, when we receive a long sequence of no
526 * updates.
527 */
528 INLINE void SmoothMover::
529 set_expected_broadcast_period(double period) {
530 _expected_broadcast_period = period;
531 }
532
533 /**
534 * Returns the interval at which we expect the SmoothNodes to broadcast their
535 * position, in elapsed seconds. See set_expected_broadcast_period().
536 */
537 INLINE double SmoothMover::
538 get_expected_broadcast_period() {
539 return _expected_broadcast_period;
540 }
541
542 /**
543 * Sets the amount of time that should elapse after the last position report
544 * before the velocity is reset to 0. This is similar to max_position_age,
545 * but it is only used to determine the resetting of the reported velocity.
546 * It should always be greater than or equal to max_position_age.
547 */
548 INLINE void SmoothMover::
549 set_reset_velocity_age(double age) {
550 _reset_velocity_age = age;
551 }
552
553 /**
554 * Returns the amount of time that should elapse after the last position
555 * report before the velocity is reset to 0. See set_reset_velocity_age().
556 */
557 INLINE double SmoothMover::
558 get_reset_velocity_age() {
559 return _reset_velocity_age;
560 }
561
562 /**
563 * Sets the flag that indicates whether the avatar's direction is considered
564 * in computing the velocity. When this is true, velocity is automatically
565 * decomposed into a forward and a lateral velocity (and both may be positive
566 * or negative); when it is false, all velocity is always returned as forward
567 * velocity (and it is always positive).
568 */
569 INLINE void SmoothMover::
570 set_directional_velocity(bool flag) {
571 _directional_velocity = flag;
572 }
573
574 /**
575 * Returns the current state of the 'directional velocity' flag. See
576 * set_directional_velocity().
577 */
578 INLINE bool SmoothMover::
579 get_directional_velocity() {
580 return _directional_velocity;
581 }
582
583 /**
584 * Sets the flag that indicates whether to assume that the node stopped moving
585 * during periods when we don't get enough position updates. If true, the
586 * object will stand still momentarily. If false, the object will
587 * continuously lerp between the position updates that we did get.
588 */
589 INLINE void SmoothMover::
590 set_default_to_standing_still(bool flag) {
591 _default_to_standing_still = flag;
592 }
593
594 /**
595 * Returns the current state of the 'default to standing still' flag. See
596 * set_default_to_standing_still().
597 */
598 INLINE bool SmoothMover::
599 get_default_to_standing_still() {
600 return _default_to_standing_still;
601 }
602
603 /**
604 * Returns the average delay observed in the last n timestamps received from
605 * this client, in seconds. This number represents the combination of the
606 * network lag from this client, as well as the client's clock skew relative
607 * to our clock. It could be negative if the client's clock is running faster
608 * than our clock.
609 */
610 INLINE double SmoothMover::
611 get_avg_timestamp_delay() const {
612 nassertr(!_timestamp_delays.empty(), 0.0);
613 return (double)_net_timestamp_delay / (double)_timestamp_delays.size() / 1000.0;
614 }
CircBuffer::size
int size() const
Returns the number of items currently in the buffer.
Definition: circBuffer.I:42
CircBuffer::empty
bool empty() const
Returns true if the buffer is empty.
Definition: circBuffer.I:54
ClockObject::get_frame_time
get_frame_time
Returns the time in seconds as of the last time tick() was called (typically, this will be as of the ...
Definition: clockObject.h:91
ClockObject::get_global_clock
static ClockObject * get_global_clock()
Returns a pointer to the global ClockObject.
Definition: clockObject.I:215
NodePath
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:159
NodePath::set_hpr
void set_hpr(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r)
Sets the rotation component of the transform, leaving translation and scale untouched.
Definition: nodePath.I:651
SmoothMover::get_sample_pos
const LPoint3 & get_sample_pos() const
Returns the current position of the working sample point.
Definition: smoothMover.I:201
SmoothMover::set_expected_broadcast_period
void set_expected_broadcast_period(double period)
Sets the interval at which we expect the SmoothNodes to broadcast their position, in elapsed seconds.
Definition: smoothMover.I:529
SmoothMover::get_delay
double get_delay()
Returns the amount of time, in seconds, to delay the computed position of a SmoothMover.
Definition: smoothMover.I:474
SmoothMover::get_directional_velocity
bool get_directional_velocity()
Returns the current state of the 'directional velocity' flag.
Definition: smoothMover.I:579
SmoothMover::get_default_to_standing_still
bool get_default_to_standing_still()
Returns the current state of the 'default to standing still' flag.
Definition: smoothMover.I:599
SmoothMover::set_prediction_mode
void set_prediction_mode(PredictionMode mode)
Sets the predictioning mode of all SmoothMovers in the world.
Definition: smoothMover.I:444
SmoothMover::compute_smooth_position
bool compute_smooth_position()
Computes the smoothed position (and orientation) of the mover at the indicated point in time,...
Definition: smoothMover.I:285
SmoothMover::set_y
bool set_y(PN_stdfloat y)
Sets the Y position only.
Definition: smoothMover.I:63
SmoothMover::apply_smooth_hpr
void apply_smooth_hpr(NodePath &node) const
Applies the smoothed orientation to the indicated NodePath.
Definition: smoothMover.I:347
SmoothMover::get_sample_hpr
const LVecBase3 & get_sample_hpr() const
Returns the current orientation of the working sample point.
Definition: smoothMover.I:212
SmoothMover::set_max_position_age
void set_max_position_age(double age)
Sets the maximum amount of time a position is allowed to remain unchanged before assuming it represen...
Definition: smoothMover.I:509
SmoothMover::compute_and_apply_smooth_hpr
void compute_and_apply_smooth_hpr(NodePath &hpr_node)
A further optimization to reduce Python calls.
Definition: smoothMover.I:381
SmoothMover::set_pos
bool set_pos(const LVecBase3 &pos)
Specifies the position of the SmoothMover at a particular time in the past.
Definition: smoothMover.I:25
SmoothMover::set_timestamp
void set_timestamp(double timestamp)
Specifies the time that the current position report applies.
Definition: smoothMover.I:247
SmoothMover::set_pos_hpr
bool set_pos_hpr(const LVecBase3 &pos, const LVecBase3 &hpr)
Specifies the position and orientation of the SmoothMover at a particular time in the past.
Definition: smoothMover.I:175
SmoothMover::get_smooth_mode
SmoothMode get_smooth_mode()
Returns the smoothing mode of all SmoothMovers in the world.
Definition: smoothMover.I:434
SmoothMover::set_hpr
bool set_hpr(const LVecBase3 &hpr)
Specifies the orientation of the SmoothMover at a particular time in the past.
Definition: smoothMover.I:100
SmoothMover::has_most_recent_timestamp
bool has_most_recent_timestamp() const
Returns true if we have most recently recorded timestamp.
Definition: smoothMover.I:263
SmoothMover::get_most_recent_timestamp
double get_most_recent_timestamp() const
Returns most recently recorded timestamp.
Definition: smoothMover.I:271
SmoothMover::set_delay
void set_delay(double delay)
Sets the amount of time, in seconds, to delay the computed position of a SmoothMover.
Definition: smoothMover.I:465
SmoothMover::get_smooth_lateral_velocity
PN_stdfloat get_smooth_lateral_velocity() const
Returns the speed at which the avatar is moving, in feet per second, along its own lateral axis (afte...
Definition: smoothMover.I:405
SmoothMover::apply_smooth_pos
void apply_smooth_pos(NodePath &node) const
Applies the smoothed position to the indicated NodePath.
Definition: smoothMover.I:323
SmoothMover::get_reset_velocity_age
double get_reset_velocity_age()
Returns the amount of time that should elapse after the last position report before the velocity is r...
Definition: smoothMover.I:558
SmoothMover::set_h
bool set_h(PN_stdfloat h)
Sets the heading only.
Definition: smoothMover.I:123
SmoothMover::get_smooth_rotational_velocity
PN_stdfloat get_smooth_rotational_velocity() const
Returns the speed at which the avatar is rotating in the horizontal plane (i.e.
Definition: smoothMover.I:415
SmoothMover::get_expected_broadcast_period
double get_expected_broadcast_period()
Returns the interval at which we expect the SmoothNodes to broadcast their position,...
Definition: smoothMover.I:538
SmoothMover::set_z
bool set_z(PN_stdfloat z)
Sets the Z position only.
Definition: smoothMover.I:78
SmoothMover::set_phony_timestamp
void set_phony_timestamp(double timestamp=0.0, bool period_adjust=false)
Lies and specifies that the current position report was received now.
Definition: smoothMover.I:222
SmoothMover::apply_smooth_pos_hpr
void apply_smooth_pos_hpr(NodePath &pos_node, NodePath &hpr_node) const
Applies the smoothed position and orientation to the indicated NodePath.
Definition: smoothMover.I:335
SmoothMover::compute_and_apply_smooth_pos_hpr
void compute_and_apply_smooth_pos_hpr(NodePath &pos_node, NodePath &hpr_node)
A further optimization to reduce Python calls.
Definition: smoothMover.I:368
SmoothMover::set_x
bool set_x(PN_stdfloat x)
Sets the X position only.
Definition: smoothMover.I:48
SmoothMover::get_prediction_mode
PredictionMode get_prediction_mode()
Returns the predictioning mode of all SmoothMovers in the world.
Definition: smoothMover.I:453
SmoothMover::get_smooth_hpr
const LVecBase3 & get_smooth_hpr() const
Returns the smoothed orientation as computed by a previous call to compute_smooth_position().
Definition: smoothMover.I:312
SmoothMover::set_directional_velocity
void set_directional_velocity(bool flag)
Sets the flag that indicates whether the avatar's direction is considered in computing the velocity.
Definition: smoothMover.I:570
SmoothMover::set_default_to_standing_still
void set_default_to_standing_still(bool flag)
Sets the flag that indicates whether to assume that the node stopped moving during periods when we do...
Definition: smoothMover.I:590
SmoothMover::set_smooth_mode
void set_smooth_mode(SmoothMode mode)
Sets the smoothing mode of all SmoothMovers in the world.
Definition: smoothMover.I:425
SmoothMover::set_r
bool set_r(PN_stdfloat r)
Sets the roll only.
Definition: smoothMover.I:153
SmoothMover::compute_and_apply_smooth_pos
void compute_and_apply_smooth_pos(NodePath &node)
A further optimization to reduce Python calls.
Definition: smoothMover.I:356
SmoothMover::set_p
bool set_p(PN_stdfloat p)
Sets the pitch only.
Definition: smoothMover.I:138
SmoothMover::set_accept_clock_skew
void set_accept_clock_skew(bool flag)
Sets the 'accept clock skew' flag.
Definition: smoothMover.I:491
SmoothMover::get_forward_axis
const LVecBase3 & get_forward_axis() const
Returns the smoothed position as computed by a previous call to compute_smooth_position().
Definition: smoothMover.I:303
SmoothMover::get_accept_clock_skew
bool get_accept_clock_skew()
Returns the current state of the 'accept clock skew' flag.
Definition: smoothMover.I:500
SmoothMover::get_max_position_age
double get_max_position_age()
Returns the maximum amount of time a position is allowed to remain unchanged before assuming it repre...
Definition: smoothMover.I:518
SmoothMover::get_smooth_forward_velocity
PN_stdfloat get_smooth_forward_velocity() const
Returns the speed at which the avatar is moving, in feet per second, along its own forward axis (afte...
Definition: smoothMover.I:394
SmoothMover::set_reset_velocity_age
void set_reset_velocity_age(double age)
Sets the amount of time that should elapse after the last position report before the velocity is rese...
Definition: smoothMover.I:549
SmoothMover::get_smooth_pos
const LPoint3 & get_smooth_pos() const
Returns the smoothed position as computed by a previous call to compute_smooth_position().
Definition: smoothMover.I:294