diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-07-15 01:23:10 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-07-15 08:32:34 -0300 |
commit | 2e73be99d8d86d9dad7bcb99518a4d3cbb5c373c (patch) | |
tree | d863db50852afe5d4b0bc15b8452054498004cb1 /scene/3d/spatial_velocity_tracker.h | |
parent | e64b82ebfcc3475c7a7d2a9196bfe20d6c9e3614 (diff) | |
download | redot-engine-2e73be99d8d86d9dad7bcb99518a4d3cbb5c373c.tar.gz |
Lots of work on Audio & Physics engine:
-Added new 3D stream player node
-Added ability for Area to capture sound from streams
-Added small features in physics to be able to properly guess distance to areas for sound
-Fixed 3D CollisionObject so shapes are added the same as in 2D, directly from children
-Fixed KinematicBody API to make it the same as 2D.
Diffstat (limited to 'scene/3d/spatial_velocity_tracker.h')
-rw-r--r-- | scene/3d/spatial_velocity_tracker.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/scene/3d/spatial_velocity_tracker.h b/scene/3d/spatial_velocity_tracker.h new file mode 100644 index 0000000000..65f3eaca93 --- /dev/null +++ b/scene/3d/spatial_velocity_tracker.h @@ -0,0 +1,31 @@ +#ifndef SPATIAL_VELOCITY_TRACKER_H +#define SPATIAL_VELOCITY_TRACKER_H + +#include "scene/3d/spatial.h" + +class SpatialVelocityTracker : public Reference { + GDCLASS(SpatialVelocityTracker, Reference) + + struct PositionHistory { + uint64_t frame; + Vector3 position; + }; + + bool fixed_step; + Vector<PositionHistory> position_history; + int position_history_len; + +protected: + static void _bind_methods(); + +public: + void reset(const Vector3 &p_new_pos); + void set_track_fixed_step(bool p_use_fixed_step); + bool is_tracking_fixed_step() const; + void update_position(const Vector3 &p_position); + Vector3 get_tracked_linear_velocity() const; + + SpatialVelocityTracker(); +}; + +#endif // SPATIAL_VELOCITY_TRACKER_H |