14 #ifndef PHYSICS_OBJECT_H
15 #define PHYSICS_OBJECT_H
39 INLINE
void set_active(
bool flag);
40 INLINE
bool get_active()
const;
42 INLINE
void set_mass(PN_stdfloat);
43 INLINE PN_stdfloat get_mass()
const;
46 INLINE
void set_position(
const LPoint3 &pos);
47 INLINE
void set_position(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
48 INLINE LPoint3 get_position()
const;
50 INLINE
void reset_position(
const LPoint3 &pos);
52 INLINE
void set_last_position(
const LPoint3 &pos);
53 INLINE LPoint3 get_last_position()
const;
55 INLINE
void set_velocity(
const LVector3 &vel);
56 INLINE
void set_velocity(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
57 INLINE LVector3 get_velocity()
const;
58 INLINE LVector3 get_implicit_velocity()
const;
61 INLINE
void add_torque(
const LRotation &torque);
62 INLINE
void add_impulse(
const LVector3 &impulse);
63 virtual void add_impact(
64 const LPoint3 &offset_from_center_of_mass,
const LVector3 &impulse);
67 INLINE
void add_local_torque(
const LRotation &torque);
68 INLINE
void add_local_impulse(
const LVector3 &impulse);
69 virtual void add_local_impact(
70 const LPoint3 &offset_from_center_of_mass,
const LVector3 &impulse);
72 INLINE
void set_terminal_velocity(PN_stdfloat tv);
73 INLINE PN_stdfloat get_terminal_velocity()
const;
75 INLINE
void set_oriented(
bool flag);
76 INLINE
bool get_oriented()
const;
78 INLINE
void set_orientation(
const LOrientation &orientation);
79 INLINE LOrientation get_orientation()
const;
81 INLINE
void reset_orientation(
const LOrientation &orientation);
83 INLINE
void set_rotation(
const LRotation &rotation);
84 INLINE LRotation get_rotation()
const;
86 virtual LMatrix4 get_inertial_tensor()
const;
87 virtual LMatrix4 get_lcs()
const;
90 #if !defined(NDEBUG) || !defined(CPPPARSER)
91 void set_name(
const std::string &name) {
94 const std::string &get_name() {
99 virtual void output(std::ostream &out)
const;
100 virtual void write(std::ostream &out,
int indent=0)
const;
103 MAKE_PROPERTY(active, get_active, set_active);
104 MAKE_PROPERTY(mass, get_mass, set_mass);
105 MAKE_PROPERTY(position, get_position, set_position);
106 MAKE_PROPERTY(last_position, get_last_position, set_last_position);
107 MAKE_PROPERTY(velocity, get_velocity, set_velocity);
108 MAKE_PROPERTY(implicit_velocity, get_implicit_velocity);
109 MAKE_PROPERTY(terminal_velocity, get_terminal_velocity, set_terminal_velocity);
110 MAKE_PROPERTY(oriented, get_oriented, set_oriented);
111 MAKE_PROPERTY(orientation, get_orientation, set_orientation);
112 MAKE_PROPERTY(rotation, get_rotation, set_rotation);
117 LPoint3 _last_position;
121 LOrientation _orientation;
124 PN_stdfloat _terminal_velocity;
136 static void init_type() {
137 TypedReferenceCount::init_type();
139 TypedReferenceCount::get_class_type());
142 return get_class_type();
144 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
This is a convenience class to specialize ConfigVariable as a floating- point type.
A body on which physics will be applied.
TypeHandle is the identifier used to differentiate C++ class types.
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
This is our own Panda specialization on the default STL vector.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.