6 #include <gmath/gmath.h>
9 AVATAR_NO_TRACKING = 0,
10 AVATAR_HEAD_TRACKING = 1,
11 AVATAR_HAND_TRACKING = 2
14 /* when head tracking is available, head_alt is ignored
16 * if HAND tracking is available, body_rot is derived from the hand
17 * orientation during the last call to walk().
19 * without head-tracking, head_rot is derived from body_rot and head_alt
24 unsigned int mode; // tracking mode
27 float body_rot; // walk direction basically
28 Quat head_rot; // used when head-tracking
29 float head_alt; // used for mouselook
34 // body forward and right vectors
40 void set_tracking_mode(unsigned int mode);
41 unsigned int get_tracking_mode() const;
43 void set_position(const Vec3 &p);
44 const Vec3 &get_position() const;
46 void set_body_rotation(float rot);
47 float get_body_rotation() const;
48 const Vec3 &get_body_fwd() const;
49 const Vec3 &get_body_right() const;
51 const Quat &get_head_rotation() const;
53 // set current head orientation when head-tracking
54 void tracked_head_rotation(const Quat &q);
56 // set current hand position/orientation when hand-tracking
57 void tracked_hand_position(int hand, const Vec3 &p);
58 void tracked_hand_rotation(int hand, const Quat &q);
60 // mouselook, or gamepad right-stick input
61 void mouselook(float horiz, float vert);
63 // calculate absolute walk direction based on forward and right
64 // magnituted, and the current mode and body orientation data
65 Vec3 calc_walk_dir(float fwd, float right) const;
67 // uses calc_walk_dir, then updates pos
68 void walk(float fwd, float right);