00001 // Filename: physicsObject.I 00002 // Created by: charles (13Jun00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 //////////////////////////////////////////////////////////////////// 00020 // Function : set_mass 00021 // Access : Public 00022 // Description : Specify the mass of the object 00023 //////////////////////////////////////////////////////////////////// 00024 INLINE void PhysicsObject:: 00025 set_mass(float m) { 00026 _mass = m; 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function : set_position 00031 // Access : Public 00032 // Description : Vector position assignment 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE void PhysicsObject:: 00035 set_position(const LPoint3f& pos) { 00036 _position = pos; 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function : set_position 00041 // Access : Public 00042 // Description : Piecewise position assignment 00043 //////////////////////////////////////////////////////////////////// 00044 INLINE void PhysicsObject:: 00045 set_position(float x, float y, float z) { 00046 _position.set(x, y, z); 00047 } 00048 00049 //////////////////////////////////////////////////////////////////// 00050 // Function : set_position_HandOfGod 00051 // Access : Public 00052 // Description : use this to place an object in a completely new 00053 // position, that has nothing to do with its last 00054 // position (moved by the Hand Of God, or "HOG") 00055 //////////////////////////////////////////////////////////////////// 00056 INLINE void PhysicsObject:: 00057 set_position_HandOfGod(const LPoint3f &pos) { 00058 _position = pos; 00059 _last_position = pos; 00060 } 00061 00062 //////////////////////////////////////////////////////////////////// 00063 // Function : set_last_position 00064 // Access : Public 00065 // Description : Last position assignment 00066 //////////////////////////////////////////////////////////////////// 00067 INLINE void PhysicsObject:: 00068 set_last_position(const LPoint3f& pos) { 00069 _last_position = pos; 00070 } 00071 00072 //////////////////////////////////////////////////////////////////// 00073 // Function : set_velocity 00074 // Access : Public 00075 // Description : Vector velocity assignment 00076 //////////////////////////////////////////////////////////////////// 00077 INLINE void PhysicsObject:: 00078 set_velocity(const LVector3f& vel) { 00079 _velocity = vel; 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function : set_velocity 00084 // Access : Public 00085 // Description : Piecewise velocity assignment 00086 //////////////////////////////////////////////////////////////////// 00087 INLINE void PhysicsObject:: 00088 set_velocity(float x, float y, float z) { 00089 _velocity.set(x, y, z); 00090 } 00091 00092 //////////////////////////////////////////////////////////////////// 00093 // Function : set_active 00094 // Access : Public 00095 // Description : Process Flag assignment 00096 //////////////////////////////////////////////////////////////////// 00097 INLINE void PhysicsObject:: 00098 set_active(bool flag) { 00099 _process_me = flag; 00100 } 00101 00102 //////////////////////////////////////////////////////////////////// 00103 // Function : set_terminal_velocity 00104 // Access : Public 00105 // Description : tv assignment 00106 //////////////////////////////////////////////////////////////////// 00107 INLINE void PhysicsObject:: 00108 set_terminal_velocity(float tv) { 00109 _terminal_velocity = tv; 00110 } 00111 00112 //////////////////////////////////////////////////////////////////// 00113 // Function : get_mass 00114 // Access : Public 00115 // Description : Mass Query 00116 //////////////////////////////////////////////////////////////////// 00117 INLINE float PhysicsObject:: 00118 get_mass(void) const { 00119 return _mass; 00120 } 00121 00122 //////////////////////////////////////////////////////////////////// 00123 // Function : get_position 00124 // Access : Public 00125 // Description : Position Query 00126 //////////////////////////////////////////////////////////////////// 00127 INLINE LPoint3f PhysicsObject:: 00128 get_position(void) const { 00129 return _position; 00130 } 00131 00132 //////////////////////////////////////////////////////////////////// 00133 // Function : get_last_position 00134 // Access : Public 00135 // Description : Last position Query 00136 //////////////////////////////////////////////////////////////////// 00137 INLINE LPoint3f PhysicsObject:: 00138 get_last_position(void) const { 00139 return _last_position; 00140 } 00141 00142 //////////////////////////////////////////////////////////////////// 00143 // Function : get_velocity 00144 // Access : Public 00145 // Description : Velocity Query 00146 //////////////////////////////////////////////////////////////////// 00147 INLINE LVector3f PhysicsObject:: 00148 get_velocity(void) const { 00149 return _velocity; 00150 } 00151 00152 //////////////////////////////////////////////////////////////////// 00153 // Function : get_active 00154 // Access : Public 00155 // Description : Process Flag Query 00156 //////////////////////////////////////////////////////////////////// 00157 INLINE bool PhysicsObject:: 00158 get_active(void) const { 00159 return _process_me; 00160 } 00161 00162 //////////////////////////////////////////////////////////////////// 00163 // Function : get_terminal_velocity 00164 // Access : Public 00165 // Description : tv query 00166 //////////////////////////////////////////////////////////////////// 00167 INLINE float PhysicsObject:: 00168 get_terminal_velocity(void) const { 00169 return _terminal_velocity; 00170 } 00171 00172 //////////////////////////////////////////////////////////////////// 00173 // Function : set_orientation 00174 // Access : Public 00175 // Description : 00176 //////////////////////////////////////////////////////////////////// 00177 INLINE void PhysicsObject:: 00178 set_orientation(const LOrientationf &orientation) { 00179 _orientation = orientation; 00180 } 00181 00182 //////////////////////////////////////////////////////////////////// 00183 // Function : set_rotation 00184 // Access : Public 00185 // Description : 00186 //////////////////////////////////////////////////////////////////// 00187 INLINE void PhysicsObject:: 00188 set_rotation(const LVector3f &rotation) { 00189 _rotation = rotation; 00190 } 00191 00192 //////////////////////////////////////////////////////////////////// 00193 // Function : get_orientation 00194 // Access : Public 00195 // Description : 00196 //////////////////////////////////////////////////////////////////// 00197 INLINE LOrientationf PhysicsObject:: 00198 get_orientation(void) const { 00199 return _orientation; 00200 } 00201 00202 //////////////////////////////////////////////////////////////////// 00203 // Function : get_rotation 00204 // Access : Public 00205 // Description : 00206 //////////////////////////////////////////////////////////////////// 00207 INLINE LVector3f PhysicsObject:: 00208 get_rotation(void) const { 00209 return _rotation; 00210 } 00211 00212 //////////////////////////////////////////////////////////////////// 00213 // Function : set_oriented 00214 // Access : Public 00215 // Description : 00216 //////////////////////////////////////////////////////////////////// 00217 INLINE void PhysicsObject:: 00218 set_oriented(bool flag) { 00219 _oriented = flag; 00220 } 00221 00222 //////////////////////////////////////////////////////////////////// 00223 // Function : get_oriented 00224 // Access : Public 00225 // Description : 00226 //////////////////////////////////////////////////////////////////// 00227 INLINE bool PhysicsObject:: 00228 get_oriented(void) const { 00229 return _oriented; 00230 }