Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

PhysicsObject Class Reference

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

#include <physicsObject.h>

Inheritance diagram for PhysicsObject:

TypedReferenceCount TypedObject ReferenceCount BaseParticle OrientedParticle PointParticle ZSpinParticle List of all members.

Public Member Functions

 PhysicsObject (void)
 Default Constructor.

 PhysicsObject (const PhysicsObject &copy)
 copy constructor

virtual ~PhysicsObject (void)
 Destructor.

const PhysicsObject & operator= (const PhysicsObject &other)
void set_mass (float)
 Specify the mass of the object.

float get_mass (void) const
 Mass Query.

void set_position (const LPoint3f &pos)
 Vector position assignment.

void set_position (float x, float y, float z)
 Piecewise position assignment.

LPoint3f get_position (void) const
 Position Query.

void set_position_HandOfGod (const LPoint3f &pos)
 use this to place an object in a completely new position, that has nothing to do with its last position (moved by the Hand Of God, or "HOG")

void set_last_position (const LPoint3f &pos)
 Last position assignment.

LPoint3f get_last_position (void) const
 Last position Query.

void set_velocity (const LVector3f &vel)
 Vector velocity assignment.

void set_velocity (float x, float y, float z)
 Piecewise velocity assignment.

LVector3f get_velocity (void) const
 Velocity Query.

void set_active (bool flag)
 Process Flag assignment.

bool get_active (void) const
 Process Flag Query.

void set_oriented (bool flag)
bool get_oriented (void) const
void set_terminal_velocity (float tv)
 tv assignment

float get_terminal_velocity (void) const
 tv query

void set_orientation (const LOrientationf &orientation)
LOrientationf get_orientation (void) const
void set_rotation (const LVector3f &rotation)
LVector3f get_rotation (void) const
virtual LMatrix4f get_inertial_tensor (void) const
 returns a transform matrix that represents the object's willingness to be forced.

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

virtual PhysicsObject * make_copy (void) const
 dynamic copy.

virtual TypeHandle get_type () const
virtual TypeHandle force_init_type ()
int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.

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

bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly.

int get_ref_count () const
 Returns the current reference count.

int ref () const
 Explicitly increments the reference count.

int unref () const
 Explicitly decrements the reference count.

void test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus.


Static Public Member Functions

TypeHandle get_class_type ()
void init_type ()

Static Public Attributes

const float _default_terminal_velocity

Private Attributes

LPoint3f _position
LPoint3f _last_position
LVector3f _velocity
LOrientationf _orientation
LVector3f _rotation
float _terminal_velocity
float _mass
bool _process_me
bool _oriented

Static Private Attributes

TypeHandle _type_handle

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.

Definition at line 40 of file physicsObject.h.


Constructor & Destructor Documentation

PhysicsObject::PhysicsObject void   ) 
 

Default Constructor.

Definition at line 35 of file physicsObject.cxx.

References _last_position, _orientation, _position, _rotation, and _velocity.

Referenced by operator=().

PhysicsObject::PhysicsObject const PhysicsObject &  copy  ) 
 

copy constructor

Definition at line 57 of file physicsObject.cxx.

PhysicsObject::~PhysicsObject void   )  [virtual]
 

Destructor.

Definition at line 70 of file physicsObject.cxx.

References _last_position, _orientation, _oriented, _position, _rotation, _terminal_velocity, and _velocity.


Member Function Documentation

virtual TypeHandle PhysicsObject::force_init_type void   )  [inline, virtual]
 

Reimplemented from TypedReferenceCount.

Definition at line 112 of file physicsObject.h.

bool PhysicsObject::get_active void   )  const [inline]
 

Process Flag Query.

Definition at line 205 of file physicsObject.I.

References _rotation, and INLINE.

TypeHandle PhysicsObject::get_class_type void   )  [inline, static]
 

Reimplemented from TypedReferenceCount.

Definition at line 101 of file physicsObject.h.

References TypedReferenceCount::get_class_type().

LMatrix4f PhysicsObject::get_inertial_tensor void   )  const [virtual]
 

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

Definition at line 139 of file physicsObject.cxx.

LPoint3f PhysicsObject::get_last_position void   )  const [inline]
 

Last position Query.

Definition at line 179 of file physicsObject.I.

References _orientation.

LMatrix4f PhysicsObject::get_lcs void   )  const [virtual]
 

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

Definition at line 119 of file physicsObject.cxx.

float PhysicsObject::get_mass void   )  const [inline]
 

Mass Query.

Definition at line 153 of file physicsObject.I.

References _process_me, and INLINE.

LOrientationf PhysicsObject::get_orientation void   )  const [inline]
 

Definition at line 254 of file physicsObject.I.

bool PhysicsObject::get_oriented void   )  const [inline]
 

Definition at line 290 of file physicsObject.I.

Referenced by ActorNode::update_transform().

LPoint3f PhysicsObject::get_position void   )  const [inline]
 

Position Query.

Definition at line 166 of file physicsObject.I.

References _terminal_velocity, and INLINE.

Referenced by GeomParticleRenderer::kill_particle(), LinearNoiseForce::~LinearNoiseForce(), LinearSinkForce::~LinearSinkForce(), and LinearSourceForce::~LinearSourceForce().

int ReferenceCount::get_ref_count  )  const [inline, inherited]
 

Returns the current reference count.

Definition at line 183 of file referenceCount.I.

Referenced by RenderState::determine_bin_index(), RenderEffects::determine_show_bounds(), FontPool::ns_garbage_collect(), TexturePool::ns_garbage_collect(), MaterialPool::ns_get_material(), and TexturePool::ns_release_texture().

LVector3f PhysicsObject::get_rotation void   )  const [inline]
 

Definition at line 266 of file physicsObject.I.

float PhysicsObject::get_terminal_velocity void   )  const [inline]
 

tv query

Definition at line 218 of file physicsObject.I.

References _oriented.

virtual TypeHandle PhysicsObject::get_type void   )  const [inline, virtual]
 

Reimplemented from TypedReferenceCount.

Definition at line 109 of file physicsObject.h.

int TypedObject::get_type_index  )  const [inline, inherited]
 

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

Definition at line 71 of file typedObject.I.

References TypeHandle::get_name(), TypedObject::get_type(), and INLINE.

LVector3f PhysicsObject::get_velocity void   )  const [inline]
 

Velocity Query.

Definition at line 192 of file physicsObject.I.

References _orientation, and INLINE.

Referenced by LinearFrictionForce::~LinearFrictionForce().

void PhysicsObject::init_type void   )  [inline, static]
 

Reimplemented from TypedReferenceCount.

Definition at line 104 of file physicsObject.h.

References TypedReferenceCount::get_class_type(), and TypedReferenceCount::init_type().

bool TypedObject::is_exact_type TypeHandle  handle  )  const [inline, inherited]
 

Returns true if the current object is the indicated type exactly.

Definition at line 101 of file typedObject.I.

Referenced by PT(), and CollisionNode::xform().

bool TypedObject::is_of_type TypeHandle  handle  )  const [inline, inherited]
 

Returns true if the current object is or derives from the indicated type.

Definition at line 86 of file typedObject.I.

Referenced by EggMaterialCollection::collapse_equivalent_materials(), EggTextureCollection::collapse_equivalent_textures(), DeferredNodeProperty::compose(), AnimBundleMaker::create_s_channel(), CharacterMaker::create_slider(), ProjectionScreen::cull_callback(), DataNode::define_output(), EggNode::determine_draw_order(), CharacterMaker::egg_to_index(), EggGroupUniquifier::EggGroupUniquifier(), EggPoolUniquifier::EggPoolUniquifier(), EggGroupNode::find_textures(), StaticTextFont::get_glyph(), EggMaterialCollection::insert_materials(), EggTextureCollection::insert_textures(), CharacterJoint::make_copy(), PT(), EggGroupNode::r_flatten_transforms(), EggGroupNode::r_transform_vertices(), EggGroupNode::recompute_polygon_normals(), CollisionLevelState::reserve(), PandaFramework::reset_frame_rate(), PandaFramework::set_texture(), EggGroupNode::steal_children(), and DataGraphTraverser::traverse().

PhysicsObject * PhysicsObject::make_copy void   )  const [virtual]
 

dynamic copy.

Reimplemented in BaseParticle, OrientedParticle, PointParticle, and ZSpinParticle.

Definition at line 104 of file physicsObject.cxx.

const PhysicsObject & PhysicsObject::operator= const PhysicsObject &  other  ) 
 

Definition at line 81 of file physicsObject.cxx.

References PhysicsObject().

int ReferenceCount::ref  )  const [inline, inherited]
 

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.

The return value is the new reference count.

Definition at line 225 of file referenceCount.I.

Referenced by ClientDevice::ClientDevice(), EggGroupNode::find_textures(), EggGroupNode::r_apply_texmats(), EggGroupNode::r_flatten_transforms(), and EggGroupNode::reverse_vertex_ordering().

void PhysicsObject::set_active bool  flag  )  [inline]
 

Process Flag assignment.

Definition at line 127 of file physicsObject.I.

References _position, and INLINE.

void PhysicsObject::set_last_position const LPoint3f &  pos  )  [inline]
 

Last position assignment.

Definition at line 88 of file physicsObject.I.

References _velocity, x, and y.

void PhysicsObject::set_mass float  m  )  [inline]
 

Specify the mass of the object.

Definition at line 31 of file physicsObject.I.

References _position, and INLINE.

void PhysicsObject::set_orientation const LOrientationf &  orientation  )  [inline]
 

Definition at line 230 of file physicsObject.I.

Referenced by ActorNode::update_transform().

void PhysicsObject::set_oriented bool  flag  )  [inline]
 

Definition at line 278 of file physicsObject.I.

Referenced by PointParticle::PointParticle().

void PhysicsObject::set_position float  x,
float  y,
float  z
[inline]
 

Piecewise position assignment.

Definition at line 57 of file physicsObject.I.

References _last_position, and _position.

void PhysicsObject::set_position const LPoint3f &  pos  )  [inline]
 

Vector position assignment.

Definition at line 44 of file physicsObject.I.

References _position, INLINE, x, and y.

Referenced by ActorNode::update_transform().

void PhysicsObject::set_position_HandOfGod const LPoint3f &  pos  )  [inline]
 

use this to place an object in a completely new position, that has nothing to do with its last position (moved by the Hand Of God, or "HOG")

Definition at line 74 of file physicsObject.I.

References _velocity, and INLINE.

void PhysicsObject::set_rotation const LVector3f &  rotation  )  [inline]
 

Definition at line 242 of file physicsObject.I.

void PhysicsObject::set_terminal_velocity float  tv  )  [inline]
 

tv assignment

Definition at line 140 of file physicsObject.I.

void PhysicsObject::set_velocity float  x,
float  y,
float  z
[inline]
 

Piecewise velocity assignment.

Definition at line 114 of file physicsObject.I.

References _mass, and INLINE.

void PhysicsObject::set_velocity const LVector3f &  vel  )  [inline]
 

Vector velocity assignment.

Definition at line 101 of file physicsObject.I.

References _terminal_velocity, and INLINE.

void ReferenceCount::test_ref_count_integrity  )  const [inline, inherited]
 

Does some easy checks to make sure that the reference count isn't completely bogus.

Definition at line 328 of file referenceCount.I.

References INLINE.

Referenced by EggNode::determine_bin(), and ReferenceCount::~ReferenceCount().

int ReferenceCount::unref  )  const [inline, inherited]
 

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 the new reference count.

Definition at line 293 of file referenceCount.I.

References INLINE.

Referenced by RenderState::determine_bin_index(), and RenderEffects::determine_show_bounds().


Member Data Documentation

const float PhysicsObject::_default_terminal_velocity [static]
 

Initial value:

  config_physics.GetFloat("default_terminal_velocity", 400.0f)

Definition at line 51 of file config_physics.cxx.

LPoint3f PhysicsObject::_last_position [private]
 

Reimplemented in BaseParticle.

Definition at line 44 of file physicsObject.h.

Referenced by PhysicsObject(), set_position(), and ~PhysicsObject().

float PhysicsObject::_mass [private]
 

Definition at line 52 of file physicsObject.h.

Referenced by set_velocity().

LOrientationf PhysicsObject::_orientation [private]
 

Definition at line 48 of file physicsObject.h.

Referenced by get_last_position(), get_velocity(), PhysicsObject(), and ~PhysicsObject().

bool PhysicsObject::_oriented [private]
 

Definition at line 55 of file physicsObject.h.

Referenced by get_terminal_velocity(), and ~PhysicsObject().

LPoint3f PhysicsObject::_position [private]
 

Definition at line 43 of file physicsObject.h.

Referenced by PhysicsObject(), set_active(), set_mass(), set_position(), and ~PhysicsObject().

bool PhysicsObject::_process_me [private]
 

Definition at line 54 of file physicsObject.h.

Referenced by get_mass().

LVector3f PhysicsObject::_rotation [private]
 

Definition at line 49 of file physicsObject.h.

Referenced by get_active(), PhysicsObject(), and ~PhysicsObject().

float PhysicsObject::_terminal_velocity [private]
 

Definition at line 51 of file physicsObject.h.

Referenced by get_position(), set_velocity(), and ~PhysicsObject().

TypeHandle PhysicsObject::_type_handle [static, private]
 

Reimplemented from TypedReferenceCount.

Definition at line 24 of file physicsObject.cxx.

LVector3f PhysicsObject::_velocity [private]
 

Definition at line 45 of file physicsObject.h.

Referenced by PhysicsObject(), set_last_position(), set_position_HandOfGod(), and ~PhysicsObject().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:53:38 2003 for Panda by doxygen1.3