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

PhysicsObject(void)
PhysicsObject(PhysicsObject const &copy)

Default Constructor

copy constructor

virtual void add_impact(LPoint3 const &offset_from_center_of_mass, LVector3 const &impulse)

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.

void add_impulse(LVector3 const &impulse)

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.

virtual void add_local_impact(LPoint3 const &offset_from_center_of_mass, LVector3 const &impulse)

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.

void add_local_impulse(LVector3 const &impulse)

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.

void add_local_torque(LRotation const &torque)

Local instantanious forces

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.

void add_torque(LRotation const &torque)

Global instantanious forces

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.

bool get_active(void) const

Process Flag Query

static TypeHandle get_class_type(void)
LVector3 get_implicit_velocity(void) const

Velocity Query over the last dt

virtual LMatrix4 get_inertial_tensor(void) const

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

LPoint3 get_last_position(void) const

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

virtual LMatrix4 get_lcs(void) const

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

PN_stdfloat get_mass(void) const

Get the mass in slugs (or kilograms).

std::string const &get_name(void)
LOrientation get_orientation(void) const

get current orientation.

bool get_oriented(void) const

See set_oriented().

LPoint3 get_position(void) const

Position Query

LRotation get_rotation(void) const

get rotation per second.

PN_stdfloat get_terminal_velocity(void) const

tv query

LVector3 get_velocity(void) const

Velocity Query per second

virtual PhysicsObject *make_copy(void) const

dynamic copy.

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

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

void reset_orientation(LOrientation const &orientation)

set the orientation while clearing the rotation velocity.

void reset_position(LPoint3 const &pos)

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

void set_active(bool flag)

Process Flag assignment

void set_last_position(LPoint3 const &pos)

Last position assignment

void set_mass(PN_stdfloat)

Set the mass in slugs (or kilograms).

void set_name(std::string const &name)
void set_orientation(LOrientation const &orientation)
void set_oriented(bool flag)

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

void set_position(LPoint3 const &pos)
void set_position(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)

INLINE void set_center_of_mass(const LPoint3 &pos); use set_position.

INLINE void set_center_of_mass(const LPoint3 &pos); use set_position.

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

Piecewise position assignment

void set_rotation(LRotation const &rotation)

set rotation as a quaternion delta per second.

void set_terminal_velocity(PN_stdfloat tv)

tv assignment

void set_velocity(LVector3 const &vel)
void set_velocity(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)

Vector velocity assignment

Piecewise velocity assignment

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

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