Panda3D
Public Member Functions | Static Public Member Functions

PhysicsObject Class Reference

A body on which physics will be applied. More...

List of all members.

Public Member Functions

 PhysicsObject ()
 Default Constructor.
 PhysicsObject (PhysicsObject const copy)
 copy constructor
 addImpact (Point3 const offset_from_center_of_mass, Vec3 const impulse)
 Adds an impulse and/or torque (i.e.
 addImpulse (Vec3 const impulse)
 Adds an impulse force (i.e.
 addLocalImpact (Point3 const offset_from_center_of_mass, Vec3 const impulse)
 Adds an impulse and/or torque (i.e.
 addLocalImpulse (Vec3 const impulse)
 Adds an impulse force (i.e.
 addLocalTorque (LRotationf const torque)
 Adds an torque force (i.e.
 addTorque (LRotationf const torque)
 Adds an torque force (i.e.
bool getActive ()
 Process Flag Query.
Vec3 getImplicitVelocity ()
 Velocity Query over the last dt.
Mat4 getInertialTensor ()
 returns a transform matrix that represents the object's willingness to be forced.
Point3 getLastPosition ()
 Get the position of the physics object at the start of the most recent do_physics.
Mat4 getLcs ()
 returns a transform matrix to this object's local coordinate system.
float getMass ()
 Get the mass in slugs (or kilograms).
string getName ()
LOrientationf getOrientation ()
 get current orientation.
bool getOriented ()
 See set_oriented().
Point3 getPosition ()
 Position Query.
LRotationf getRotation ()
 get rotation per second.
float getTerminalVelocity ()
 tv query
Vec3 getVelocity ()
 Velocity Query per second.
PhysicsObject makeCopy ()
 dynamic copy.
PhysicsObject operator= (PhysicsObject const other)
 output (ostream out)
 Write a string representation of this instance to <out>.
 resetOrientation (LOrientationf const orientation)
 set the orientation while clearing the rotation velocity.
 resetPosition (Point3 const pos)
 use this to place an object in a completely new position, that has nothing to do with its last position.
 setActive (bool flag)
 Process Flag assignment.
 setLastPosition (Point3 const pos)
 Last position assignment.
 setMass (float)
 Set the mass in slugs (or kilograms).
 setName (string name)
 setOrientation (LOrientationf const orientation)
 setOriented (bool flag)
 Set flag to determine whether this object should do any rotation or orientation calculations.
 setPosition (float x, float y, float z)
 Piecewise position assignment.
 setPosition (Point3 const pos)
 Vector position assignment.
 setRotation (LRotationf const rotation)
 set rotation as a quaternion delta per second.
 setTerminalVelocity (float tv)
 tv assignment
 setVelocity (float x, float y, float z)
 Piecewise velocity assignment.
 setVelocity (Vec3 const vel)
 Vector velocity assignment.
 write (ostream out, unsigned int indent)
 Write a string representation of this instance to <out>.
 write (ostream out)
 Write a string representation of this instance to <out>.

Static Public Member Functions

static TypeHandle getClassType ()

Detailed Description

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.


Constructor & Destructor Documentation

Default Constructor.

PhysicsObject ( PhysicsObject const  copy)

copy constructor


Member Function Documentation

addImpact ( Point3 const  offset_from_center_of_mass,
Vec3 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.

addImpulse ( Vec3 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.

addLocalImpact ( Point3 const  offset_from_center_of_mass,
Vec3 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.

addLocalImpulse ( Vec3 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.

addLocalTorque ( LRotationf const  torque)

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.

addTorque ( LRotationf const  torque)

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 getActive ( )

Process Flag Query.

static TypeHandle getClassType ( ) [static]
Vec3 getImplicitVelocity ( )

Velocity Query over the last dt.

Mat4 getInertialTensor ( )

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

Point3 getLastPosition ( )

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

Mat4 getLcs ( )

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

float getMass ( )

Get the mass in slugs (or kilograms).

string getName ( )
LOrientationf getOrientation ( )

get current orientation.

bool getOriented ( )

See set_oriented().

Point3 getPosition ( )

Position Query.

LRotationf getRotation ( )

get rotation per second.

float getTerminalVelocity ( )

tv query

Vec3 getVelocity ( )

Velocity Query per second.

PhysicsObject makeCopy ( )

dynamic copy.

PhysicsObject operator= ( PhysicsObject const  other)
output ( ostream  out)

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

resetOrientation ( LOrientationf const  orientation)

set the orientation while clearing the rotation velocity.

resetPosition ( Point3 const  pos)

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

setActive ( bool  flag)

Process Flag assignment.

setLastPosition ( Point3 const  pos)

Last position assignment.

setMass ( float  )

Set the mass in slugs (or kilograms).

setName ( string  name)
setOrientation ( LOrientationf const  orientation)
setOriented ( bool  flag)

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

Optimization.

setPosition ( float  x,
float  y,
float  z 
)

Piecewise position assignment.

setPosition ( Point3 const  pos)

Vector position assignment.

This is also used as the center of mass.

setRotation ( LRotationf const  rotation)

set rotation as a quaternion delta per second.

setTerminalVelocity ( float  tv)

tv assignment

setVelocity ( float  x,
float  y,
float  z 
)

Piecewise velocity assignment.

setVelocity ( Vec3 const  vel)

Vector velocity assignment.

write ( ostream  out)

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

write ( ostream  out,
unsigned int  indent 
)

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

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties