Physical

class Physical

Bases: TypedReferenceCount

Defines a set of physically modeled attributes. If you want physics applied to your class, derive it from this.

Inheritance diagram

Inheritance diagram of Physical

explicit Physical(int total_objects = 1, bool pre_alloc = false)
Physical(Physical const &copy)

Default Constructor The idea here is that most physicals will NOT be collections of sets (i.e. particle systems and whatever else). Because of this, the default constructor, unless otherwise specified, will automatically allocate and initialize one PhysicalObject. This makes it easier for high-level work.

pre-alloc is ONLY for multiple-object physicals, and if true, fills the physics_object vector with dead nodes, pre-allocating for the speed end of the speed-vs-overhead deal.

copy constructor (note- does deep copy of pn’s) but does NOT attach itself to its template’s physicsmanager.

void add_angular_force(AngularForce *f)

Adds an angular force to the force list

void add_linear_force(LinearForce *f)

Adds a linear force to the force list

void add_physics_object(PhysicsObject *po)

Adds an object to the physics object vector

void clear_angular_forces(void)

Erases the angular force list

void clear_linear_forces(void)

Erases the linear force list

void clear_physics_objects(void)

Erases the object list

PointerTo<AngularForce> get_angular_force(int index) const
static TypeHandle get_class_type(void)
PointerTo<LinearForce> get_linear_force(int index) const
int get_num_angular_forces(void) const
int get_num_linear_forces(void) const
PhysicsObjectCollection const get_objects(void) const
PhysicsObject *get_phys_body(void) const
PhysicalNode *get_physical_node(void) const
NodePath get_physical_node_path(void) const
PhysicsManager *get_physics_manager(void) const

helpers

PN_stdfloat get_viscosity(void) const

Get the local viscosity.

virtual void output(std::ostream &out = ::std::cout) const

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

void remove_angular_force(AngularForce *f)

removes an angular force from the force list

void remove_linear_force(LinearForce *f)

removes a linear force from the force list

void set_viscosity(PN_stdfloat viscosity)

Set the local viscosity.

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

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

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

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

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

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

virtual void write_physics_objects(std::ostream &out = ::std::cout, int indent = 0) const

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