Panda3D
Public Member Functions | Static Public Member Functions | List of all members
PhysicsObject Class Reference

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

Inheritance diagram for PhysicsObject:
TypedReferenceCount TypedObject ReferenceCount

Public Member Functions

 __init__ ()
 Default Constructor. More...
 
 __init__ (const PhysicsObject copy)
 copy constructor More...
 
 addImpact (const LPoint3 offset_from_center_of_mass, const LVector3 impulse)
 Adds an impulse and/or torque (i.e. More...
 
 addImpulse (const LVector3 impulse)
 Adds an impulse force (i.e. More...
 
 addLocalImpact (const LPoint3 offset_from_center_of_mass, const LVector3 impulse)
 Adds an impulse and/or torque (i.e. More...
 
 addLocalImpulse (const LVector3 impulse)
 Adds an impulse force (i.e. More...
 
 addLocalTorque (const LRotation torque)
 Adds an torque force (i.e. More...
 
 addTorque (const LRotation torque)
 Adds an torque force (i.e. More...
 
bool getActive ()
 Process Flag Query. More...
 
LVector3 getImplicitVelocity ()
 Velocity Query over the last dt. More...
 
LMatrix4 getInertialTensor ()
 returns a transform matrix that represents the object's willingness to be forced. More...
 
LPoint3 getLastPosition ()
 Get the position of the physics object at the start of the most recent do_physics. More...
 
LMatrix4 getLcs ()
 returns a transform matrix to this object's local coordinate system. More...
 
float getMass ()
 Get the mass in slugs (or kilograms). More...
 
str getName ()
 
LOrientation getOrientation ()
 get current orientation. More...
 
bool getOriented ()
 See set_oriented(). More...
 
LPoint3 getPosition ()
 Position Query. More...
 
LRotation getRotation ()
 get rotation per second. More...
 
float getTerminalVelocity ()
 tv query More...
 
LVector3 getVelocity ()
 Velocity Query per second. More...
 
PhysicsObject makeCopy ()
 dynamic copy. More...
 
PhysicsObject operator= (const PhysicsObject other)
 
 output (Ostream out)
 Write a string representation of this instance to <out>. More...
 
 resetOrientation (const LOrientation orientation)
 set the orientation while clearing the rotation velocity. More...
 
 resetPosition (const LPoint3 pos)
 use this to place an object in a completely new position, that has nothing to do with its last position. More...
 
 setActive (bool flag)
 Process Flag assignment. More...
 
 setLastPosition (const LPoint3 pos)
 Last position assignment. More...
 
 setMass (float)
 Set the mass in slugs (or kilograms). More...
 
 setName (str name)
 
 setOrientation (const LOrientation orientation)
 
 setOriented (bool flag)
 Set flag to determine whether this object should do any rotation or orientation calculations. More...
 
 setPosition (const LPoint3 pos)
 Vector position assignment. More...
 
 setPosition (float x, float y, float z)
 Piecewise position assignment. More...
 
 setRotation (const LRotation rotation)
 set rotation as a quaternion delta per second. More...
 
 setTerminalVelocity (float tv)
 tv assignment More...
 
 setVelocity (const LVector3 vel)
 Vector velocity assignment. More...
 
 setVelocity (float x, float y, float z)
 Piecewise velocity assignment. More...
 
 write (Ostream out, int indent)
 Write a string representation of this instance to <out>. More...
 
- Public Member Functions inherited from TypedObject
TypeHandle getType ()
 
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly. More...
 
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type. More...
 
- Public Member Functions inherited from ReferenceCount
int getRefCount ()
 Returns the current reference count. More...
 
 ref ()
 Explicitly increments the reference count. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
bool unref ()
 Explicitly decrements the reference count. More...
 

Static Public Member Functions

static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle getClassType ()
 

Additional Inherited Members

- Public Attributes inherited from TypedObject
TypeHandle type
 Returns the TypeHandle representing this object's type. More...
 
- Public Attributes inherited from ReferenceCount
int ref_count
 The current reference count. More...
 

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.

Member Function Documentation

◆ __init__() [1/2]

__init__ ( )

Default Constructor.

◆ __init__() [2/2]

__init__ ( const PhysicsObject  copy)

copy constructor

◆ addImpact()

addImpact ( const LPoint3  offset_from_center_of_mass,
const LVector3  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()

addImpulse ( const LVector3  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()

addLocalImpact ( const LPoint3  offset_from_center_of_mass,
const LVector3  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()

addLocalImpulse ( const LVector3  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()

addLocalTorque ( const LRotation  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()

addTorque ( const LRotation  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.

◆ getActive()

bool getActive ( )

Process Flag Query.

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getImplicitVelocity()

LVector3 getImplicitVelocity ( )

Velocity Query over the last dt.

◆ getInertialTensor()

LMatrix4 getInertialTensor ( )

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

◆ getLastPosition()

LPoint3 getLastPosition ( )

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

◆ getLcs()

LMatrix4 getLcs ( )

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

◆ getMass()

float getMass ( )

Get the mass in slugs (or kilograms).

◆ getName()

str getName ( )

◆ getOrientation()

LOrientation getOrientation ( )

get current orientation.

◆ getOriented()

bool getOriented ( )

See set_oriented().

◆ getPosition()

LPoint3 getPosition ( )

Position Query.

◆ getRotation()

LRotation getRotation ( )

get rotation per second.

◆ getTerminalVelocity()

float getTerminalVelocity ( )

tv query

◆ getVelocity()

LVector3 getVelocity ( )

Velocity Query per second.

◆ makeCopy()

PhysicsObject makeCopy ( )

dynamic copy.

◆ operator=()

PhysicsObject operator= ( const PhysicsObject  other)

◆ output()

output ( Ostream  out)

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

◆ resetOrientation()

resetOrientation ( const LOrientation  orientation)

set the orientation while clearing the rotation velocity.

◆ resetPosition()

resetPosition ( const LPoint3  pos)

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

◆ setActive()

setActive ( bool  flag)

Process Flag assignment.

◆ setLastPosition()

setLastPosition ( const LPoint3  pos)

Last position assignment.

◆ setMass()

setMass ( float  )

Set the mass in slugs (or kilograms).

◆ setName()

setName ( str  name)

◆ setOrientation()

setOrientation ( const LOrientation  orientation)

◆ setOriented()

setOriented ( bool  flag)

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

Optimization.

◆ setPosition() [1/2]

setPosition ( const LPoint3  pos)

Vector position assignment.

This is also used as the center of mass.

◆ setPosition() [2/2]

setPosition ( float  x,
float  y,
float  z 
)

Piecewise position assignment.

◆ setRotation()

setRotation ( const LRotation  rotation)

set rotation as a quaternion delta per second.

◆ setTerminalVelocity()

setTerminalVelocity ( float  tv)

tv assignment

◆ setVelocity() [1/2]

setVelocity ( const LVector3  vel)

Vector velocity assignment.

◆ setVelocity() [2/2]

setVelocity ( float  x,
float  y,
float  z 
)

Piecewise velocity assignment.

◆ write()

write ( Ostream  out,
int  indent 
)

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