# Physical¶

from panda3d.physics import 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

__init__(copy: Physical)

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

__init__(total_objects: int, pre_alloc: bool)

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.

addAngularForce(f: AngularForce)None

Adds an angular force to the force list

addLinearForce(f: LinearForce)None

Adds a linear force to the force list

addPhysicsObject(po: PhysicsObject)None

Adds an object to the physics object vector

clearAngularForces()None

Erases the angular force list

clearLinearForces()None

Erases the linear force list

clearPhysicsObjects()None

Erases the object list

getAngularForce(index: int)AngularForce
getAngularForces()list
static getClassType()panda3d.core.TypeHandle
getLinearForce(index: int)LinearForce
getLinearForces()list
getNumAngularForces()int
getNumLinearForces()int
getObjects()PhysicsObjectCollection
getPhysBody()PhysicsObject
getPhysicalNode()PhysicalNode
getPhysicalNodePath()panda3d.core.NodePath
getPhysicsManager()PhysicsManager

helpers

getViscosity()float

Get the local viscosity.

output(out: panda3d.core.ostream)None

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

removeAngularForce(f: AngularForce)None

removes an angular force from the force list

removeLinearForce(f: LinearForce)None

removes a linear force from the force list

setViscosity(viscosity: float)None

Set the local viscosity.

write(out: panda3d.core.ostream, indent: int)None

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

writeAngularForces(out: panda3d.core.ostream, indent: int)None

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

writeLinearForces(out: panda3d.core.ostream, indent: int)None

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

writePhysicsObjects(out: panda3d.core.ostream, indent: int)None

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