@@ -25,46 +25,57 @@ class PhysicsComponent: public cxx::noncopyable
2525 glm::vec3 mSmoothPosition ; // for rendering only
2626
2727public:
28- // set/get object's world position and rotation angle
29- // @param position: Coordinate
30- // @param rotationAngle: Rotation, optional
28+ virtual ~PhysicsComponent ();
29+
30+ // Set or get object's world position and rotation angle
31+ // @param position: Coordinate, meters
32+ // @param rotationAngle: Angle
3133 void SetPosition (const glm::vec3& position);
3234 void SetPosition (const glm::vec3& position, cxx::angle_t rotationAngle);
3335 glm::vec3 GetPosition () const ;
34- // set/get object's heading angle
35- // @param rotationAngle: Angle value
36+
37+ // Set or get object's heading angle
38+ // @param rotationAngle: Angle
3639 void SetRotationAngle (cxx::angle_t rotationAngle);
3740 cxx::angle_t GetRotationAngle () const ;
38- // set/get current angular velocity
39- // @param velocity: new angular velocity in degrees/second
40- void SetAngularVelocity (float angularVelocity);
41- float GetAngularVelocity () const ;
42- // / set/get the linear velocity of the center of mass
43- // / @param velocity: new linear velocity of the center of mass
41+
42+ // Set or get current angular velocity
43+ // @param velocity: New angular velocity in degrees/second
44+ void SetAngularVelocity (cxx::angle_t angularVelocity);
45+ cxx::angle_t GetAngularVelocity () const ;
46+
47+ // / Set or get the linear velocity of the center of mass
48+ // / @param velocity: New linear velocity of the center of mass, meters per second
4449 void SetLinearVelocity (const glm::vec2& velocity);
4550 glm::vec2 GetLinearVelocity () const ;
4651 glm::vec2 GetSignVector () const ;
47- // convert coordinate from local to world space and vice versa
52+
53+ // Convert coordinate from local to world space and vice versa
54+ // @param localPosition, worldPosition: Coordinate in meters
4855 glm::vec2 GetWorldPoint (const glm::vec2& localPosition) const ;
4956 glm::vec2 GetLocalPoint (const glm::vec2& worldPosition) const ;
50- // apply an impulse to the center of mass
57+
58+ // Apply an impulse to the center of mass
5159 // @param impulse: The world impulse vector, usually in N-seconds or kg-m/s
5260 void AddLinearImpulse (const glm::vec2& impulse);
53- // apply a force to the center of mass
61+
62+ // Apply a force to the center of mass
5463 // @param force: Force, the world force vector, usually in Newtons (N)
5564 void AddForce (const glm::vec2& force);
56- // apply an angular impulse
65+
66+ // Apply an angular impulse
5767 // @param impulse the angular impulse in units of kg*m*m/s
5868 void AddAngularImpulse (float impulse);
59- // cancel currently active forces
69+
70+ // Cancel currently active forces
6071 void ClearForces ();
61- // clear state
72+
73+ // Clear state
6274 void SetRespawned ();
6375
6476protected:
6577 // only derived classes could be instantiated
6678 PhysicsComponent (b2World* physicsWorld);
67- virtual ~PhysicsComponent ();
6879
6980protected:
7081 b2World* mPhysicsWorld ;
0 commit comments