00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PHYSICS_OBJECT_H
00020 #define PHYSICS_OBJECT_H
00021
00022 #include <pandabase.h>
00023 #include <typedReferenceCount.h>
00024 #include <luse.h>
00025
00026
00027
00028
00029
00030
00031
00032 class EXPCL_PANDAPHYSICS PhysicsObject : public TypedReferenceCount {
00033 private:
00034
00035 LPoint3f _position;
00036 LPoint3f _last_position;
00037 LVector3f _velocity;
00038
00039
00040 LOrientationf _orientation;
00041 LVector3f _rotation;
00042
00043 float _terminal_velocity;
00044 float _mass;
00045
00046 bool _process_me;
00047 bool _oriented;
00048
00049 PUBLISHED:
00050 PhysicsObject(void);
00051 PhysicsObject(const PhysicsObject ©);
00052 virtual ~PhysicsObject(void);
00053 const PhysicsObject &operator =(const PhysicsObject &other);
00054
00055 static const float _default_terminal_velocity;
00056
00057 INLINE void set_mass(float);
00058 INLINE float get_mass(void) const;
00059
00060 INLINE void set_position(const LPoint3f &pos);
00061 INLINE void set_position(float x, float y, float z);
00062 INLINE LPoint3f get_position(void) const;
00063
00064 INLINE void set_position_HandOfGod(const LPoint3f &pos);
00065
00066 INLINE void set_last_position(const LPoint3f &pos);
00067 INLINE LPoint3f get_last_position(void) const;
00068
00069 INLINE void set_velocity(const LVector3f &vel);
00070 INLINE void set_velocity(float x, float y, float z);
00071 INLINE LVector3f get_velocity(void) const;
00072
00073 INLINE void set_active(bool flag);
00074 INLINE bool get_active(void) const;
00075
00076 INLINE void set_oriented(bool flag);
00077 INLINE bool get_oriented(void) const;
00078
00079 INLINE void set_terminal_velocity(float tv);
00080 INLINE float get_terminal_velocity(void) const;
00081
00082 INLINE void set_orientation(const LOrientationf &orientation);
00083 INLINE LOrientationf get_orientation(void) const;
00084
00085 INLINE void set_rotation(const LVector3f &rotation);
00086 INLINE LVector3f get_rotation(void) const;
00087
00088 virtual LMatrix4f get_inertial_tensor(void) const;
00089 virtual LMatrix4f get_lcs(void) const;
00090 virtual PhysicsObject *make_copy(void) const;
00091
00092 public:
00093 static TypeHandle get_class_type() {
00094 return _type_handle;
00095 }
00096 static void init_type() {
00097 TypedReferenceCount::init_type();
00098 register_type(_type_handle, "PhysicsObject",
00099 TypedReferenceCount::get_class_type());
00100 }
00101 virtual TypeHandle get_type() const {
00102 return get_class_type();
00103 }
00104 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00105
00106 private:
00107 static TypeHandle _type_handle;
00108 };
00109
00110 #include "physicsObject.I"
00111
00112 #endif // __PHYSICS_OBJECT_H__