11 void Avatar::set_tracking_mode(unsigned int mode)
16 unsigned int Avatar::get_tracking_mode() const
21 void Avatar::set_position(const Vec3 &p)
26 const Vec3 &Avatar::get_position() const
31 void Avatar::set_body_rotation(float rot)
35 float theta = deg_to_rad(body_rot);
39 right = Vec3(-fwd.z, 0, fwd.x);
42 float Avatar::get_body_rotation() const
47 const Vec3 &Avatar::get_body_fwd() const
52 const Vec3 &Avatar::get_body_right() const
57 const Quat &Avatar::get_head_rotation() const
62 void Avatar::tracked_head_rotation(const Quat &q)
67 // TODO maybe transform from head-relative first
68 void Avatar::tracked_hand_position(int hand, const Vec3 &p)
73 // TODO maybe transform from head-relative first
74 void Avatar::tracked_hand_rotation(int hand, const Quat &q)
79 void Avatar::mouselook(float horiz, float vert)
83 if(head_alt > M_PI / 2.0) head_alt = M_PI / 2.0;
84 if(head_alt < -M_PI / 2.0) head_alt = -M_PI / 2.0;
87 Vec3 Avatar::calc_walk_dir(float fwd, float right) const
89 float theta = M_PI * body_rot / 180.0f;
90 float dx = cos(theta) * right - sin(theta) * fwd;
91 float dz = sin(theta) * right + cos(theta) * fwd;
92 return Vec3(dx, 0, dz);
95 void Avatar::walk(float fwd, float right)
97 Vec3 wdir = calc_walk_dir(fwd, right);