CollisionHandlerGravity

Inheritance:

Methods of CollisionHandlerGravity:

Methods of CollisionHandlerPhysical:

Methods of CollisionHandlerEvent:

Methods of CollisionHandler:

Methods of TypedReferenceCount:

Methods of TypedObject:

Methods of ReferenceCount:

addVelocity
void CollisionHandlerGravity::add_velocity(float velocity);

Description: Adds the sepcified amount to the current velocity. This is mostly here allow this common operation to be faster for scripting, but it's also more concise even in cpp.

getAirborneHeight
float CollisionHandlerGravity::get_airborne_height(void) const;

Description: Return the height of the object from the ground.
The object might not necessarily be at rest. Use is_on_ground() if you want to know whether the object is on the ground and at rest.
See Also: is_in_outer_space()

getClassType
static TypeHandle CollisionHandlerGravity::get_class_type(void);

Undocumented function.

getContactNormal
LVector3f const &CollisionHandlerGravity::get_contact_normal(void) const;

Description :

getGravity
float CollisionHandlerGravity::get_gravity(void) const;

Description: Gets the linear gravity force (always plumb).

getImpactVelocity
float CollisionHandlerGravity::get_impact_velocity(void) const;

Description: How hard did the object hit the ground. This value is set on impact with the ground. You may want to watch (poll) on is_on_groun() and when that is true, call get_impact_velocity(). Normally I avoid polling, but we are calling is_on_ground() frequently anyway.

getMaxVelocity
float CollisionHandlerGravity::get_max_velocity(void) const;

Description: Retrieves the maximum speed at which the object will be allowed to descend towards a floor below it, in units per second. See set_max_velocity().

getOffset
float CollisionHandlerGravity::get_offset(void) const;

Description: Returns the linear offset to add to (or subtract from) the highest detected collision point to determine the actual height at which to set the collider.

getReach
float CollisionHandlerGravity::get_reach(void) const;

Description: Returns the reach to add to (or subtract from) the highest collision point

getVelocity
float CollisionHandlerGravity::get_velocity(void) const;

Description: Gets the current vertical velocity.
Generally, negative values mean the object is in free fall; while postive values mean the object has vertical thrust.
A zero value does not necessarily mean the object on the ground, it may also be weightless and/or at the apex of its jump.
See Also: is_on_ground() and get_gravity()

isOnGround
bool CollisionHandlerGravity::is_on_ground(void) const;

Description: Is the object at rest?

setGravity
void CollisionHandlerGravity::set_gravity(float gravity);

Description: Sets the linear gravity force (always plumb).

setMaxVelocity
void CollisionHandlerGravity::set_max_velocity(float max_vel);

Description: Sets the maximum speed at which the object will be allowed to descend towards a floor below it, in units per second. Set this to zero to allow it to instantly teleport any distance.

setOffset
void CollisionHandlerGravity::set_offset(float offset);

Filename: CollisionHandlerGravity.I Created by: drose (16Mar02)
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: Sets the linear offset to add to (or subtract from) the highest detected collision point to determine the actual height at which to set the collider.

setReach
void CollisionHandlerGravity::set_reach(float reach);

Description: Sets the reach to add to (or subtract from) the highest collision point

setVelocity
void CollisionHandlerGravity::set_velocity(float velocity);

Description: Sets the current vertical velocity.

addCollider
void CollisionHandlerPhysical::add_collider(NodePath const &collider, NodePath const &target);

Description: Adds a new collider to the list with a NodePath that will be updated with the collider's new position, or updates the existing collider with a new NodePath object.
The indicated DriveInterface will also be updated with the target's new transform each frame. This method should be used when the target is directly controlled by a DriveInterface.

clearCenter
void CollisionHandlerPhysical::clear_center(void);

Description: Clears the center NodePath specified with set_center.

clearColliders
void CollisionHandlerPhysical::clear_colliders(void);

Description: Completely empties the list of colliders this handler knows about.

getCenter
NodePath const &CollisionHandlerPhysical::get_center(void) const;

Description: Returns the NodePath specified with set_center, or the empty NodePath if nothing has been specified.

getClassType
static TypeHandle CollisionHandlerPhysical::get_class_type(void);

Undocumented function.

hasCenter
bool CollisionHandlerPhysical::has_center(void) const;

Description: Returns true if a NodePath has been specified with set_center(), false otherwise.

hasCollider
bool CollisionHandlerPhysical::has_collider(NodePath const &collider) const;

Description: Returns true if the handler knows about the indicated collider, false otherwise.

hasContact
bool CollisionHandlerPhysical::has_contact(void) const;

Description: Did the handler make any contacts with anything on the last collision pass? Depending on how your world is setup, this can be used to tell if the handler is out of the world (i.e. out of bounds). That is the original use of this call.

removeCollider
bool CollisionHandlerPhysical::remove_collider(NodePath const &collider);

Description: Removes the collider from the list of colliders that this handler knows about.

setCenter
void CollisionHandlerPhysical::set_center(NodePath const &center);

Filename: collisionHandlerPhysical.I Created by: drose (16Mar02)
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: Specifies an arbitrary NodePath that the handler is always considered to be facing. It does not detect collisions with surfaces that appear to be facing away from this NodePath. This works best when the collision surfaces in question are polygons.

addAgainPattern
void CollisionHandlerEvent::add_again_pattern(string const &again_pattern);

Description: Adds the pattern string that indicates how the event names are generated when a collision between two particular nodes is *still* detected. This event is thrown each consecutive time a collision between two particular nodes is detected, starting with the second time.
In general, the in_pattern event is thrown on the first detection of a collision between two particular nodes. In subsequent passes, as long as a collision between those two nodes continues to be detected each frame, the again_pattern is thrown. The first frame in which the collision is no longer detected, the out_pattern event is thrown.

addInPattern
void CollisionHandlerEvent::add_in_pattern(string const &in_pattern);

Description: Adds a pattern string to the list of events that will be generated in response to a collision. The pattern string describes how the event name will be composed. It is a string that may contain any of the following:
%fn - the name of the "from" object's node %in - the name of the "into" object's node %fs - 't' if "from" is tangible, 'i' if intangible %is - 't' if "into" is tangible, 'i' if intangible %ig - 'c' if the collision is into a CollisionNode, 'g' if it is a geom.
%(tag)fh - generate event only if "from" node has the indicated net tag. %(tag)fx - generate event only if "from" node does not have the indicated net tag. %(tag)ih - generate event only if "into" node has the indicated net tag. %(tag)ix - generate event only if "into" node does not have the indicated net tag. %(tag)ft - the indicated net tag value of the "from" node. %(tag)it - the indicated net tag value of the "into" node.
Parentheses in the above are literal and should be included in the actual pattern.
The event name will be based on the in_pattern string specified here, with all occurrences of the above strings replaced with the corresponding values.
In general, the in_pattern event is thrown on the first detection of a collision between two particular nodes. In subsequent passes, as long as a collision between those two nodes continues to be detected each frame, the again_pattern is thrown. The first frame in which the collision is no longer detected, the out_pattern event is thrown.

addOutPattern
void CollisionHandlerEvent::add_out_pattern(string const &out_pattern);

Description: Adds the pattern string that indicates how the event names are generated when a collision between two particular nodes is *no longer* detected.
In general, the in_pattern event is thrown on the first detection of a collision between two particular nodes. In subsequent passes, as long as a collision between those two nodes continues to be detected each frame, the again_pattern is thrown. The first frame in which the collision is no longer detected, the out_pattern event is thrown.

clear
void CollisionHandlerEvent::clear(void);

Description: Empties the list of elements that all colliders are known to be colliding with. No "out" events will be thrown; if the same collision is detected next frame, a new "in" event will be thrown for each collision.
This can be called each frame to defeat the persistent "in" event mechanism, which prevents the same "in" event from being thrown repeatedly. However, also see add_again_pattern(), which can be used to set the event that is thrown when a collision is detected for two or more consecutive frames.

clearAgainPatterns
void CollisionHandlerEvent::clear_again_patterns(void);

Description: Removes all of the previously-added in patterns. See add_again_pattern.

clearInPatterns
void CollisionHandlerEvent::clear_in_patterns(void);

Description: Removes all of the previously-added in patterns. See add_in_pattern.

clearOutPatterns
void CollisionHandlerEvent::clear_out_patterns(void);

Description: Removes all of the previously-added in patterns. See add_out_pattern.

getAgainPattern
string CollisionHandlerEvent::get_again_pattern(int n) const;

Description: Returns the nth pattern string that indicates how the event names are generated for each collision detected. See add_again_pattern().

getClassType
static TypeHandle CollisionHandlerEvent::get_class_type(void);

Undocumented function.

getInPattern
string CollisionHandlerEvent::get_in_pattern(int n) const;

Description: Returns the nth pattern string that indicates how the event names are generated for each collision detected. See add_in_pattern().

getNumAgainPatterns
int CollisionHandlerEvent::get_num_again_patterns(void) const;

Description: Returns the number of in pattern strings that have been added.

getNumInPatterns
int CollisionHandlerEvent::get_num_in_patterns(void) const;

Description: Returns the number of in pattern strings that have been added.

getNumOutPatterns
int CollisionHandlerEvent::get_num_out_patterns(void) const;

Description: Returns the number of in pattern strings that have been added.

getOutPattern
string CollisionHandlerEvent::get_out_pattern(int n) const;

Description: Returns the nth pattern string that indicates how the event names are generated for each collision detected. See add_out_pattern().

setAgainPattern
void CollisionHandlerEvent::set_again_pattern(string const &again_pattern);

Description: This method is deprecated; it completely replaces all the in patterns that have previously been set with the indicated pattern.

setInPattern
void CollisionHandlerEvent::set_in_pattern(string const &in_pattern);

Description: This method is deprecated; it completely replaces all the in patterns that have previously been set with the indicated pattern.

setOutPattern
void CollisionHandlerEvent::set_out_pattern(string const &out_pattern);

Description: This method is deprecated; it completely replaces all the in patterns that have previously been set with the indicated pattern.

getClassType
static TypeHandle CollisionHandler::get_class_type(void);

Undocumented function.

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.