Panda3D

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | Friends | List of all members
PhysicsManager Class Reference

Physics don't get much higher-level than this. More...

`#include "physicsManager.h"`

## Public Types
typedef pvector< PT(AngularForce)> | AngularForceVector
typedef pvector< PT(LinearForce)> | LinearForceVector
typedef pvector< Physical * > | PhysicalsVector

## Public Member Functions
| PhysicsManager ()
| Default Constructor.
virtual | ~PhysicsManager ()
| Simple Destructor.
void | add_angular_force (AngularForce *f)
| Adds a global angular force to the physics manager.
void | add_linear_force (LinearForce *f)
| Adds a global linear force to the physics manager.
void | attach_angular_integrator (AngularIntegrator *i)
| Hooks an angular integrator into the manager.
void | attach_linear_integrator (LinearIntegrator *i)
| Hooks a linear integrator into the manager.
void | attach_physical (Physical *p)
| Registers a Physical class with the manager.
void | attach_physical_node (PhysicalNode *p)
| Registers a physicalnode with the manager.
void | attach_physicalnode (PhysicalNode *p)
| Please call attach_physical_node instead.
void | clear_angular_forces ()
| Resets the physics manager force vector.
void | clear_linear_forces ()
| Resets the physics manager force vector.
void | clear_physicals ()
| Resets the physics manager objects vector.
virtual void | debug_output (std::ostream &out, int indent=0) const
| Write a string representation of this instance to <out>.
void | do_physics (PN_stdfloat dt)
| This is the main high-level API call.
void | do_physics (PN_stdfloat dt, Physical *p)
| This is the main high-level API call.
PN_stdfloat | get_viscosity () const
| Get the global viscosity.
void | init_random_seed ()
| One-time config function, sets up the random seed used by the physics and particle systems.
virtual void | output (std::ostream &out) const
| Write a string representation of this instance to <out>.
void | remove_angular_force (AngularForce *f)
| takes an angular force out of the physics list
void | remove_linear_force (LinearForce *f)
| takes a linear force out of the physics list
void | remove_physical (Physical *p)
| takes a physical out of the object list
void | remove_physical_node (PhysicalNode *p)
| Removes a physicalnode from the manager.
void | set_viscosity (PN_stdfloat viscosity)
| Set the global viscosity.
virtual void | write (std::ostream &out, int indent=0) const
| Write a string representation of this instance to <out>.
virtual void | write_angular_forces (std::ostream &out, int indent=0) const
| Write a string representation of this instance to <out>.
virtual void | write_linear_forces (std::ostream &out, int indent=0) const
| Write a string representation of this instance to <out>.
virtual void | write_physicals (std::ostream &out, int indent=0) const
| Write a string representation of this instance to <out>.

## Static Public Attributes
static ConfigVariableInt | _random_seed

## Friends
class | Physical

## Detailed Description

Physics don't get much higher-level than this.

Attach as many Physicals (particle systems, etc..) as you want, pick an integrator and go.

Definition at line 36 of file physicsManager.h.

## Member Typedef Documentation

## ◆ AngularForceVector

typedef pvector<PT(AngularForce)> PhysicsManager::AngularForceVector

Definition at line 46 of file physicsManager.h.

## ◆ LinearForceVector

typedef pvector<PT(LinearForce)> PhysicsManager::LinearForceVector

Definition at line 45 of file physicsManager.h.

## ◆ PhysicalsVector

typedef pvector<Physical *> PhysicsManager::PhysicalsVector

Definition at line 44 of file physicsManager.h.

## Constructor & Destructor Documentation

## ◆ PhysicsManager()

PhysicsManager::PhysicsManager | ( |  | ) |

Default Constructor.

NOTE: EulerIntegrator is the standard default.

Definition at line 28 of file physicsManager.cxx.

## ◆ ~PhysicsManager()

PhysicsManager::~PhysicsManager | ( |  | ) |
| virtual

Simple Destructor.

Definition at line 38 of file physicsManager.cxx.

## Member Function Documentation

## ◆ add_angular_force()

void PhysicsManager::add_angular_force | ( | AngularForce * | f | ) |
| inline

Adds a global angular force to the physics manager.

Definition at line 76 of file physicsManager.I.

## ◆ add_linear_force()

void PhysicsManager::add_linear_force | ( | LinearForce * | f | ) |
| inline

Adds a global linear force to the physics manager.

Definition at line 31 of file physicsManager.I.

## ◆ attach_angular_integrator()

void PhysicsManager::attach_angular_integrator | ( | AngularIntegrator * | i | ) |
| inline

Hooks an angular integrator into the manager.

Definition at line 130 of file physicsManager.I.

## ◆ attach_linear_integrator()

void PhysicsManager::attach_linear_integrator | ( | LinearIntegrator * | i | ) |
| inline

Hooks a linear integrator into the manager.

Definition at line 121 of file physicsManager.I.

## ◆ attach_physical()

void PhysicsManager::attach_physical | ( | Physical * | p | ) |
| inline

Registers a Physical class with the manager.

Definition at line 17 of file physicsManager.I.

Referenced by attach_physical_node().

## ◆ attach_physical_node()

void PhysicsManager::attach_physical_node | ( | PhysicalNode * | p | ) |
| inline

Registers a physicalnode with the manager.

Definition at line 57 of file physicsManager.I.

References attach_physical().

Referenced by attach_physicalnode().

## ◆ attach_physicalnode()

void PhysicsManager::attach_physicalnode | ( | PhysicalNode * | p | ) |
| inline

Please call attach_physical_node instead.

Definition at line 45 of file physicsManager.I.

References attach_physical_node().

## ◆ clear_angular_forces()

void PhysicsManager::clear_angular_forces | ( |  | ) |
| inline

Resets the physics manager force vector.

Definition at line 89 of file physicsManager.I.

## ◆ clear_linear_forces()

void PhysicsManager::clear_linear_forces | ( |  | ) |
| inline

Resets the physics manager force vector.

Definition at line 68 of file physicsManager.I.

## ◆ clear_physicals()

void PhysicsManager::clear_physicals | ( |  | ) |
| inline

Resets the physics manager objects vector.

Definition at line 97 of file physicsManager.I.

## ◆ debug_output()

void PhysicsManager::debug_output | ( | std::ostream & | out,
|  | int | indent = 0 ) const
| virtual

Write a string representation of this instance to <out>.

Definition at line 272 of file physicsManager.cxx.

References indent().

## ◆ do_physics() [1/2]

void PhysicsManager::do_physics | ( | PN_stdfloat | dt | ) |

This is the main high-level API call.

Performs integration on every attached Physical.

Definition at line 124 of file physicsManager.cxx.

References TypedObject::is_of_type(), and ActorNode::update_transform().

## ◆ do_physics() [2/2]

void PhysicsManager::do_physics | ( | PN_stdfloat | dt,
|  | Physical * | physical )

This is the main high-level API call.

Performs integration on a single physical. Make sure its associated forces are active.

Definition at line 155 of file physicsManager.cxx.

References TypedObject::is_of_type(), and ActorNode::update_transform().

## ◆ get_viscosity()

PN_stdfloat PhysicsManager::get_viscosity | ( |  | ) | const
| inline

Get the global viscosity.

Definition at line 113 of file physicsManager.I.

## ◆ init_random_seed()

void PhysicsManager::init_random_seed | ( |  | ) |

One-time config function, sets up the random seed used by the physics and particle systems.

For synchronizing across distributed computers

Definition at line 51 of file physicsManager.cxx.

## ◆ output()

void PhysicsManager::output | ( | std::ostream & | out | ) | const
| virtual

Write a string representation of this instance to <out>.

Definition at line 180 of file physicsManager.cxx.

## ◆ remove_angular_force()

void PhysicsManager::remove_angular_force | ( | AngularForce * | f | ) |

takes an angular force out of the physics list

Definition at line 78 of file physicsManager.cxx.

## ◆ remove_linear_force()

void PhysicsManager::remove_linear_force | ( | LinearForce * | f | ) |

takes a linear force out of the physics list

Definition at line 61 of file physicsManager.cxx.

## ◆ remove_physical()

void PhysicsManager::remove_physical | ( | Physical * | p | ) |

takes a physical out of the object list

Definition at line 95 of file physicsManager.cxx.

Referenced by remove_physical_node().

## ◆ remove_physical_node()

void PhysicsManager::remove_physical_node | ( | PhysicalNode * | p | ) |

Removes a physicalnode from the manager.

Definition at line 112 of file physicsManager.cxx.

References remove_physical().

## ◆ set_viscosity()

void PhysicsManager::set_viscosity | ( | PN_stdfloat | viscosity | ) |
| inline

Set the global viscosity.

Definition at line 105 of file physicsManager.I.

## ◆ write()

void PhysicsManager::write | ( | std::ostream & | out,
|  | int | indent = 0 ) const
| virtual

Write a string representation of this instance to <out>.

Definition at line 242 of file physicsManager.cxx.

References indent(), write_angular_forces(), write_linear_forces(), and write_physicals().

## ◆ write_angular_forces()

void PhysicsManager::write_angular_forces | ( | std::ostream & | out,
|  | int | indent = 0 ) const
| virtual

Write a string representation of this instance to <out>.

Definition at line 226 of file physicsManager.cxx.

References indent().

Referenced by write().

## ◆ write_linear_forces()

void PhysicsManager::write_linear_forces | ( | std::ostream & | out,
|  | int | indent = 0 ) const
| virtual

Write a string representation of this instance to <out>.

Definition at line 210 of file physicsManager.cxx.

References indent().

Referenced by write().

## ◆ write_physicals()

void PhysicsManager::write_physicals | ( | std::ostream & | out,
|  | int | indent = 0 ) const
| virtual

Write a string representation of this instance to <out>.

Definition at line 190 of file physicsManager.cxx.

References indent().

Referenced by write().

## Friends And Related Symbol Documentation

## ◆ Physical

friend class Physical
| friend

Definition at line 83 of file physicsManager.h.

## Member Data Documentation

## ◆ _random_seed

ConfigVariableInt PhysicsManager::_random_seed
| static

Definition at line 84 of file physicsManager.h.

The documentation for this class was generated from the following files:

- panda/src/physics/physicsManager.h
- panda/src/physics/physicsManager.cxx
- panda/src/physics/physicsManager.I