panda3d.physics.PhysicsObject

class PhysicsObject

Bases: TypedReferenceCount

A body on which physics will be applied. If you’re looking to add physical motion to your class, do NOT derive from this. Derive from Physical instead.

Inheritance diagram

Inheritance diagram of PhysicsObject

__init__() → None

Default Constructor

__init__(copy: PhysicsObject) → None

copy constructor

assign(other: PhysicsObject) → PhysicsObject
Return type

PhysicsObject

setActive(flag: bool) → None

Process Flag assignment

getActive() → bool

Process Flag Query

setMass(param0: float) → None

Set the mass in slugs (or kilograms).

getMass() → float

Get the mass in slugs (or kilograms).

setPosition(pos: LPoint3) → None

Vector position assignment. This is also used as the center of mass.

setPosition(x: float, y: float, z: float) → None

Piecewise position assignment

getPosition() → LPoint3

Position Query

Return type

LPoint3

resetPosition(pos: LPoint3) → None

use this to place an object in a completely new position, that has nothing to do with its last position.

setLastPosition(pos: LPoint3) → None

Last position assignment

getLastPosition() → LPoint3

Get the position of the physics object at the start of the most recent do_physics.

Return type

LPoint3

setVelocity(vel: LVector3) → None

Vector velocity assignment

setVelocity(x: float, y: float, z: float) → None

Piecewise velocity assignment

getVelocity() → LVector3

Velocity Query per second

Return type

LVector3

getImplicitVelocity() → LVector3

Velocity Query over the last dt

Return type

LVector3

addTorque(torque: LRotation) → None

Adds an torque force (i.e. an instantanious change in velocity). This is a quicker way to get the angular velocity, add a vector to it and set that value to be the new angular velocity.

addImpulse(impulse: LVector3) → None

Adds an impulse force (i.e. an instantanious change in velocity). This is a quicker way to get the velocity, add a vector to it and set that value to be the new velocity.

addImpact(offset_from_center_of_mass: LPoint3, impulse: LVector3) → None

Adds an impulse and/or torque (i.e. an instantanious change in velocity) based on how well the offset and impulse align with the center of mass (aka position). If you wanted to immitate this function you could work out the impulse and torque and call add_impulse and add_torque respectively. offset and force are in global (or parent) coordinates.

addLocalTorque(torque: LRotation) → None

Adds an torque force (i.e. an instantanious change in velocity). This is a quicker way to get the angular velocity, add a vector to it and set that value to be the new angular velocity.

addLocalImpulse(impulse: LVector3) → None

Adds an impulse force (i.e. an instantanious change in velocity). This is a quicker way to get the velocity, add a vector to it and set that value to be the new velocity.

addLocalImpact(offset_from_center_of_mass: LPoint3, impulse: LVector3) → None

Adds an impulse and/or torque (i.e. an instantanious change in velocity) based on how well the offset and impulse align with the center of mass (aka position). If you wanted to immitate this function you could work out the impulse and torque and call add_impulse and add_torque respectively. offset and force are in local coordinates.

setTerminalVelocity(tv: float) → None

tv assignment

getTerminalVelocity() → float

tv query

setOriented(flag: bool) → None

Set flag to determine whether this object should do any rotation or orientation calculations. Optimization.

getOriented() → bool

See setOriented().

setOrientation(orientation: LOrientation) → None
getOrientation() → LOrientation

get current orientation.

Return type

LOrientation

resetOrientation(orientation: LOrientation) → None

set the orientation while clearing the rotation velocity.

setRotation(rotation: LRotation) → None

set rotation as a quaternion delta per second.

getRotation() → LRotation

get rotation per second.

Return type

LRotation

getInertialTensor() → LMatrix4

returns a transform matrix that represents the object’s willingness to be forced.

Return type

LMatrix4

getLcs() → LMatrix4

returns a transform matrix to this object’s local coordinate system.

Return type

LMatrix4

makeCopy() → PhysicsObject

dynamic copy.

Return type

PhysicsObject

setName(name: str) → None
getName() → str
output(out: ostream) → None

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

write(out: ostream, indent: int) → None

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

static getClassType() → TypeHandle
Return type

TypeHandle