# PhysicsObject

from pandac.PandaModules import PhysicsObject

Class : PhysicsObject
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.

## Inheritance:

PhysicsObject: TypedReferenceCount
TypedReferenceCount: TypedObject ReferenceCount
TypedObject:
ReferenceCount:

## Methods of PhysicsObject:

addImpact
addImpulse
addLocalImpact
addLocalImpulse
addLocalTorque
addTorque
getActive
getClassType
getImplicitVelocity
getInertialTensor
getLastPosition
getLcs
getMass
getName
getOrientation
getOriented
getPosition
getRotation
getTerminalVelocity
getVelocity
makeCopy
operator =
output
resetOrientation
resetPosition
setActive
setLastPosition
setMass
setName
setOrientation
setOriented
setPosition
setRotation
setTerminalVelocity
setVelocity
write

## Methods of TypedReferenceCount:

getClassType

## Methods of TypedObject:

getClassType
getType
getTypeIndex
isExactType
isOfType

## Methods of ReferenceCount:

getClassType
getRefCount
ref
testRefCountIntegrity
testRefCountNonzero
unref

addImpact virtual void PhysicsObject::add_impact(LPoint3f const &offset_from_center_of_mass, LVector3f const &impulse); Description : 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 void PhysicsObject::add_impulse(LVector3f const &impulse); Global instantanious forces Description : 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 virtual void PhysicsObject::add_local_impact(LPoint3f const &offset_from_center_of_mass, LVector3f const &impulse); Description : 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 void PhysicsObject::add_local_impulse(LVector3f const &impulse); Local instantanious forces Description : 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 void PhysicsObject::add_local_torque(LRotationf const &torque); Local instantanious forces Description : 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 void PhysicsObject::add_torque(LRotationf const &torque); Global instantanious forces Description : 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 PhysicsObject::get_active(void) const; Description : Process Flag Query

getClassType static TypeHandle PhysicsObject::get_class_type(void); Undocumented function.

getImplicitVelocity LVector3f PhysicsObject::get_implicit_velocity(void) const; Description : Velocity Query over the last dt

getInertialTensor virtual LMatrix4f PhysicsObject::get_inertial_tensor(void) const; Description : returns a transform matrix that represents the object's willingness to be forced.

getLastPosition LPoint3f PhysicsObject::get_last_position(void) const; Description : Get the position of the physics object at the start of the most recent do_physics.

getLcs virtual LMatrix4f PhysicsObject::get_lcs(void) const; Description : returns a transform matrix to this object's local coordinate system.

getMass float PhysicsObject::get_mass(void) const; Description : Get the mass in slugs (or kilograms).

getName string const &PhysicsObject::get_name(void); Undocumented function.

getOrientation LOrientationf PhysicsObject::get_orientation(void) const; Description : get current orientation.

getOriented bool PhysicsObject::get_oriented(void) const; Description : See set_oriented().

getPosition LPoint3f PhysicsObject::get_position(void) const; Description : Position Query

getRotation LRotationf PhysicsObject::get_rotation(void) const; Description : get rotation per second.

getTerminalVelocity float PhysicsObject::get_terminal_velocity(void) const; Description : tv query

getVelocity LVector3f PhysicsObject::get_velocity(void) const; Description : Velocity Query per second

makeCopy virtual PhysicsObject *PhysicsObject::make_copy(void) const; Description : dynamic copy.

operator = PhysicsObject const &PhysicsObject::operator =(PhysicsObject const &other); Description :

output virtual void PhysicsObject::output(ostream &out) const; Description : Write a string representation of this instance to <out>.

resetOrientation void PhysicsObject::reset_orientation(LOrientationf const &orientation); Description : set the orientation while clearing the rotation velocity.

resetPosition void PhysicsObject::reset_position(LPoint3f const &pos); Description : use this to place an object in a completely new position, that has nothing to do with its last position.

setActive void PhysicsObject::set_active(bool flag); Description : Process Flag assignment

setLastPosition void PhysicsObject::set_last_position(LPoint3f const &pos); Description : Last position assignment

setMass void PhysicsObject::set_mass(float ); Filename: physicsObject.I Created by: charles (13Jun00) PANDA 3D SOFTWARE Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved All use of this software is subject to the terms of the Panda 3d Software license. You should have received a copy of this license along with this source code; you will also find a current copy of the license at http://etc.cmu.edu/panda3d/docs/license/ . To contact the maintainers of this program write to panda3d-general@lists.sourceforge.net . Description : Set the mass in slugs (or kilograms).

setName void PhysicsObject::set_name(string const &name); Undocumented function.

setOrientation void PhysicsObject::set_orientation(LOrientationf const &orientation); Description :

setOriented void PhysicsObject::set_oriented(bool flag); Description : Set flag to determine whether this object should do any rotation or orientation calculations. Optimization.

setPosition void PhysicsObject::set_position(LPoint3f const &pos); INLINE void set_center_of_mass(const LPoint3f &pos); use set_position. Description : Vector position assignment. This is also used as the center of mass. Description : Piecewise position assignment

setRotation void PhysicsObject::set_rotation(LRotationf const &rotation); Description : set rotation as a quaternion delta per second.

setTerminalVelocity void PhysicsObject::set_terminal_velocity(float tv); Description : tv assignment

setVelocity void PhysicsObject::set_velocity(LVector3f const &vel); Description : Vector velocity assignment Description : Piecewise velocity assignment

write virtual void PhysicsObject::write(ostream &out, unsigned int indent = (0)) const; Description : Write a string representation of this instance to <out>.

getClassType static TypeHandle TypedReferenceCount::get_class_type(void); Undocumented function.

getClassType static TypeHandle TypedObject::get_class_type(void); Undocumented function.

getType virtual TypeHandle TypedObject::get_type(void) const = 0; Derived classes should override this function to return get_class_type().

getTypeIndex int TypedObject::get_type_index(void) const; Description: Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index().

isExactType bool TypedObject::is_exact_type(TypeHandle handle) const; Description: Returns true if the current object is the indicated type exactly.

isOfType bool TypedObject::is_of_type(TypeHandle handle) const; Description: Returns true if the current object is or derives from the indicated type.

getClassType static TypeHandle ReferenceCount::get_class_type(void); Undocumented function.

getRefCount int ReferenceCount::get_ref_count(void) const; Description: Returns the current reference count.

ref void ReferenceCount::ref(void) const; Description: Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

testRefCountIntegrity bool ReferenceCount::test_ref_count_integrity(void) const; Description: Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise.

testRefCountNonzero bool ReferenceCount::test_ref_count_nonzero(void) const; Description: Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise.

unref bool ReferenceCount::unref(void) const; Description: Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete(). User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is true if the new reference count is nonzero, false if it is zero.