00001 // --------------------------------------------------------------------------- 00002 // PLATFORM: All - 00003 // PRODUCT: Fourplay - 00004 // VISIBILITY: Public - 00005 // --------------------------------------------------------------------------- 00006 // - 00007 // PURPOSE: Circular physics object. Used for projectile motion - 00008 // and collision checking/response. - 00009 // - 00010 // --------------------------------------------------------------------------- 00011 00012 #ifndef PHYSICSOBJECT_H 00013 #define PHYSICSOBJECT_H 00014 00015 #include "Iw2D.h" 00016 00023 class PhysicsObject { 00024 public: 00028 PhysicsObject() {} 00029 00037 PhysicsObject(CIwFVec2 position, 00038 float gravityScale, 00039 float radius, 00040 float mass); 00041 00045 ~PhysicsObject(); 00046 00051 CIwFVec2 GetPosition(); 00052 00057 void SetPosition(CIwFVec2 position); 00058 00063 void Update(double deltaTime); 00064 00069 float GetRadius(); 00070 00075 float GetGravityScale(); 00076 00081 float GetMass(); 00082 00087 CIwFVec2 GetVelocity(); 00088 00093 void SetVelocity(CIwFVec2 newVelocity); 00094 00099 void SetGravityScale(float scale); 00100 00105 int GetNumCollisions(); 00106 00110 void IncrementNumCollisions(); 00111 00116 float GetBounciness(); 00117 00122 float GetBottom(); 00123 00128 void SetRadius(float radius); 00129 00135 CIwFVec2 GetNextPosition(double deltaTime); 00136 00137 protected: 00139 CIwFVec2 m_position; 00140 00142 CIwFVec2 m_velocity; 00143 00145 CIwFVec2 m_gravity; 00146 00148 CIwFVec2 m_acceleration; 00149 00151 float m_gravityScale; 00152 00154 float m_radius; 00155 00157 float m_mass; 00158 00160 int m_numCollisions; 00161 00163 float m_bounciness; 00164 }; 00165 00166 #endif