Changeset 1336 for trunk/orbital/tank.h
- Timestamp:
- May 3, 2012, 1:54:17 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/orbital/tank.h
r1335 r1336 14 14 public: 15 15 Tank() 16 : m_ angle(0.f),16 : m_turret_angle(0.f), 17 17 m_ready(false) 18 18 { 19 m_body.SendCommand("sc0.1,0.1,0,1,ab6,6,15,ty-2,sc1,1,1,1,afcb4,5,16,0.4,tx4, mx,fl,sc0.2,0.7,0,1,afcb8,7,10,0.4,tz-4,fl");20 m_ head.SendCommand("sc0.2,0.7,0,1,afcb3,6,10,0.4,tx-8,afcb3,6,10,0.4,tx4,ty10,fl,sc1,1,1,1,afcb3,6,10,0.4,rx-30,ty10,fl");19 m_body.SendCommand("sc0.1,0.1,0,1,ab6,6,15,ty-2,sc1,1,1,1,afcb4,5,16,0.4,tx4,ty5,mx,fl,sc0.2,0.7,0,1,afcb8,7,10,0.4,tz-4,ty5,fl"); 20 m_turret.SendCommand("sc0.2,0.7,0,1,afcb3,6,10,0.4,tx-8,afcb3,6,10,0.4,tx4,ty13,fl,sc1,1,1,1,afcb3,6,10,0.4,rx-30,ty13,fl"); 21 21 } 22 22 … … 27 27 char const *GetName() { return "<tank>"; } 28 28 29 /* Set a target for the tank */ 30 void SetTarget(vec3 const &position) 31 { 32 m_target = position; 33 } 34 29 35 protected: 30 36 virtual void TickGame(float seconds) … … 32 38 WorldEntity::TickGame(seconds); 33 39 34 m_rotation *= quat::rotate(seconds * 20.f, vec3(0, 1, 0)); 35 m_angle += seconds * 50.f; 40 float test = RandF(0.f, +40.f); 41 m_rotation *= quat::rotate(seconds * test, vec3(0, 1, 0)); 42 m_velocity = m_rotation.transform(vec3(0, 0, 1)); 43 m_position += seconds * 40.f * m_velocity; 44 45 m_turret_angle += seconds * 50.f; 36 46 } 37 47 … … 43 53 { 44 54 m_body.SendCommand("irb"); 45 m_ head.SendCommand("irb");55 m_turret.SendCommand("irb"); 46 56 m_ready = true; 47 57 } … … 50 60 m_body.Render(model); 51 61 52 model = model * mat4::rotate(m_ angle, vec3(0, 1, 0));53 m_ head.Render(model);62 model = model * mat4::rotate(m_turret_angle, vec3(0, 1, 0)); 63 m_turret.Render(model); 54 64 } 55 65 56 66 private: 57 Mesh m_body, m_head; 58 float m_angle; 67 Mesh m_body, m_turret; 68 vec3 m_target; 69 float m_turret_angle; 59 70 bool m_ready; 60 71 };
Note: See TracChangeset
for help on using the changeset viewer.