physicsObject.I 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. // Filename: physics_object.I
  2. // Created by: charles (13Jun00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. ////////////////////////////////////////////////////////////////////
  6. // Function : set_mass
  7. // Access : Public
  8. // Description : Specify the mass of the object
  9. ////////////////////////////////////////////////////////////////////
  10. INLINE void PhysicsObject::
  11. set_mass(float m) {
  12. _mass = m;
  13. }
  14. ////////////////////////////////////////////////////////////////////
  15. // Function : set_position
  16. // Access : Public
  17. // Description : Vector position assignment
  18. ////////////////////////////////////////////////////////////////////
  19. INLINE void PhysicsObject::
  20. set_position(const LPoint3f& pos) {
  21. _position = pos;
  22. }
  23. ////////////////////////////////////////////////////////////////////
  24. // Function : set_position
  25. // Access : Public
  26. // Description : Piecewise position assignment
  27. ////////////////////////////////////////////////////////////////////
  28. INLINE void PhysicsObject::
  29. set_position(float x, float y, float z) {
  30. _position.set(x, y, z);
  31. }
  32. ////////////////////////////////////////////////////////////////////
  33. // Function : set_position_HandOfGod
  34. // Access : Public
  35. // Description : use this to place an object in a completely new
  36. // position, that has nothing to do with its last
  37. // position (moved by the Hand Of God, or "HOG")
  38. ////////////////////////////////////////////////////////////////////
  39. INLINE void PhysicsObject::
  40. set_position_HandOfGod(const LPoint3f &pos) {
  41. _position = pos;
  42. _last_position = pos;
  43. }
  44. ////////////////////////////////////////////////////////////////////
  45. // Function : set_last_position
  46. // Access : Public
  47. // Description : Last position assignment
  48. ////////////////////////////////////////////////////////////////////
  49. INLINE void PhysicsObject::
  50. set_last_position(const LPoint3f& pos) {
  51. _last_position = pos;
  52. }
  53. ////////////////////////////////////////////////////////////////////
  54. // Function : set_velocity
  55. // Access : Public
  56. // Description : Vector velocity assignment
  57. ////////////////////////////////////////////////////////////////////
  58. INLINE void PhysicsObject::
  59. set_velocity(const LVector3f& vel) {
  60. _velocity = vel;
  61. }
  62. ////////////////////////////////////////////////////////////////////
  63. // Function : set_velocity
  64. // Access : Public
  65. // Description : Piecewise velocity assignment
  66. ////////////////////////////////////////////////////////////////////
  67. INLINE void PhysicsObject::
  68. set_velocity(float x, float y, float z) {
  69. _velocity.set(x, y, z);
  70. }
  71. ////////////////////////////////////////////////////////////////////
  72. // Function : set_active
  73. // Access : Public
  74. // Description : Process Flag assignment
  75. ////////////////////////////////////////////////////////////////////
  76. INLINE void PhysicsObject::
  77. set_active(bool flag) {
  78. _process_me = flag;
  79. }
  80. ////////////////////////////////////////////////////////////////////
  81. // Function : set_terminal_velocity
  82. // Access : Public
  83. // Description : tv assignment
  84. ////////////////////////////////////////////////////////////////////
  85. INLINE void PhysicsObject::
  86. set_terminal_velocity(float tv) {
  87. _terminal_velocity = tv;
  88. }
  89. ////////////////////////////////////////////////////////////////////
  90. // Function : get_mass
  91. // Access : Public
  92. // Description : Mass Query
  93. ////////////////////////////////////////////////////////////////////
  94. INLINE float PhysicsObject::
  95. get_mass(void) const {
  96. return _mass;
  97. }
  98. ////////////////////////////////////////////////////////////////////
  99. // Function : get_position
  100. // Access : Public
  101. // Description : Position Query
  102. ////////////////////////////////////////////////////////////////////
  103. INLINE LPoint3f PhysicsObject::
  104. get_position(void) const {
  105. return _position;
  106. }
  107. ////////////////////////////////////////////////////////////////////
  108. // Function : get_last_position
  109. // Access : Public
  110. // Description : Last position Query
  111. ////////////////////////////////////////////////////////////////////
  112. INLINE LPoint3f PhysicsObject::
  113. get_last_position(void) const {
  114. return _last_position;
  115. }
  116. ////////////////////////////////////////////////////////////////////
  117. // Function : get_velocity
  118. // Access : Public
  119. // Description : Velocity Query
  120. ////////////////////////////////////////////////////////////////////
  121. INLINE LVector3f PhysicsObject::
  122. get_velocity(void) const {
  123. return _velocity;
  124. }
  125. ////////////////////////////////////////////////////////////////////
  126. // Function : get_active
  127. // Access : Public
  128. // Description : Process Flag Query
  129. ////////////////////////////////////////////////////////////////////
  130. INLINE bool PhysicsObject::
  131. get_active(void) const {
  132. return _process_me;
  133. }
  134. ////////////////////////////////////////////////////////////////////
  135. // Function : get_terminal_velocity
  136. // Access : Public
  137. // Description : tv query
  138. ////////////////////////////////////////////////////////////////////
  139. INLINE float PhysicsObject::
  140. get_terminal_velocity(void) const {
  141. return _terminal_velocity;
  142. }
  143. ////////////////////////////////////////////////////////////////////
  144. // Function : set_orientation
  145. // Access : Public
  146. // Description :
  147. ////////////////////////////////////////////////////////////////////
  148. INLINE void PhysicsObject::
  149. set_orientation(const LOrientationf &orientation) {
  150. _orientation = orientation;
  151. }
  152. ////////////////////////////////////////////////////////////////////
  153. // Function : set_rotation
  154. // Access : Public
  155. // Description :
  156. ////////////////////////////////////////////////////////////////////
  157. INLINE void PhysicsObject::
  158. set_rotation(const LVector3f &rotation) {
  159. _rotation = rotation;
  160. }
  161. ////////////////////////////////////////////////////////////////////
  162. // Function : get_orientation
  163. // Access : Public
  164. // Description :
  165. ////////////////////////////////////////////////////////////////////
  166. INLINE LOrientationf PhysicsObject::
  167. get_orientation(void) const {
  168. return _orientation;
  169. }
  170. ////////////////////////////////////////////////////////////////////
  171. // Function : get_rotation
  172. // Access : Public
  173. // Description :
  174. ////////////////////////////////////////////////////////////////////
  175. INLINE LVector3f PhysicsObject::
  176. get_rotation(void) const {
  177. return _rotation;
  178. }
  179. ////////////////////////////////////////////////////////////////////
  180. // Function : set_oriented
  181. // Access : Public
  182. // Description :
  183. ////////////////////////////////////////////////////////////////////
  184. INLINE void PhysicsObject::
  185. set_oriented(bool flag) {
  186. _oriented = flag;
  187. }
  188. ////////////////////////////////////////////////////////////////////
  189. // Function : get_oriented
  190. // Access : Public
  191. // Description :
  192. ////////////////////////////////////////////////////////////////////
  193. INLINE bool PhysicsObject::
  194. get_oriented(void) const {
  195. return _oriented;
  196. }