21 _linear_forces.erase(_linear_forces.begin(),
22 _linear_forces.end());
30 _angular_forces.erase(_angular_forces.begin(),
31 _angular_forces.end());
39 _physics_objects.erase(_physics_objects.begin(),
40 _physics_objects.end());
48 _linear_forces.push_back(f);
56 _angular_forces.push_back(f);
64 LinearForceVector::iterator found;
69 found = find(_linear_forces.begin(), _linear_forces.end(), pt_lf);
71 if (found == _linear_forces.end())
74 _linear_forces.erase(found);
82 AngularForceVector::iterator found;
85 found = find(_angular_forces.begin(), _angular_forces.end(), pt_af);
87 if (found == _angular_forces.end())
90 _angular_forces.erase(found);
98 _physics_objects.push_back(po);
105 get_physics_manager()
const {
106 return _physics_manager;
113 get_phys_body()
const {
121 get_physical_node()
const {
122 return _physical_node;
129 get_physical_node_path()
const {
137 get_object_vector()
const {
138 return _physics_objects;
145 get_linear_forces()
const {
146 return _linear_forces;
153 get_angular_forces()
const {
154 return _angular_forces;
160 INLINE
int Physical::
161 get_num_linear_forces()
const {
162 return _linear_forces.size();
169 get_linear_force(
int index)
const {
170 nassertr(index >= 0 && index < (
int)_linear_forces.size(),
nullptr);
171 return _linear_forces[index];
177 INLINE
int Physical::
178 get_num_angular_forces()
const {
179 return _angular_forces.size();
186 get_angular_force(
int index)
const {
187 nassertr(index >= 0 && index < (
int)_angular_forces.size(),
nullptr);
188 return _angular_forces[index];
194 INLINE
void Physical::
195 set_viscosity(PN_stdfloat viscosity) {
196 _viscosity=viscosity;
void remove_angular_force(AngularForce *f)
removes an angular force from the force list
A basic node of the scene graph or data graph.
A body on which physics will be applied.
PN_stdfloat get_viscosity() const
Get the local viscosity.
void clear_physics_objects()
Erases the object list.
A force that acts on a PhysicsObject by way of an Integrator.
PT(LinearForce) Physical
Set the local viscosity.
Graph node that encapsulated a series of physical objects.
Physics don't get much higher-level than this.
void add_linear_force(LinearForce *f)
Adds a linear force to the force list.
void add_angular_force(AngularForce *f)
Adds an angular force to the force list.
pure virtual parent of all quat-based forces.
void remove_linear_force(LinearForce *f)
removes a linear force from the force list
void add_physics_object(PhysicsObject *po)
Adds an object to the physics object vector.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
void clear_angular_forces()
Erases the angular force list.
void clear_linear_forces()
Erases the linear force list.