Panda3D
Public Member Functions | Static Public Member Functions | Protected Member Functions

CollisionHandlerFloor Class Reference

A specialized kind of CollisionHandler that sets the Z height of the collider to a fixed linear offset from the highest detected collision point each frame. More...

#include "collisionHandlerFloor.h"

Inheritance diagram for CollisionHandlerFloor:
CollisionHandlerPhysical CollisionHandlerEvent CollisionHandler TypedReferenceCount TypedObject ReferenceCount MemoryBase MemoryBase

List of all members.

Public Member Functions

virtual TypeHandle force_init_type ()
PN_stdfloat get_max_velocity () const
 Retrieves the maximum speed at which the object will be allowed to descend towards a floor below it, in units per second.
PN_stdfloat get_offset () const
 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.
PN_stdfloat get_reach () const
 Returns the reach to add to (or subtract from) the highest collision point.
virtual TypeHandle get_type () const
void set_max_velocity (PN_stdfloat max_vel)
 Sets the maximum speed at which the object will be allowed to descend towards a floor below it, in units per second.
void set_offset (PN_stdfloat offset)
 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.
void set_reach (PN_stdfloat reach)
 Sets the reach to add to (or subtract from) the highest collision point.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()
 This function is declared non-inline to work around a compiler bug in g++ 2.96.

Protected Member Functions

virtual void apply_linear_force (ColliderDef &def, const LVector3 &force)
virtual bool handle_entries ()
 Called by the parent class after all collisions have been detected, this manages the various collisions and moves around the nodes as necessary.
PN_stdfloat set_highest_collision (const NodePath &target_node_path, const NodePath &from_node_path, const Entries &entries)

Detailed Description

A specialized kind of CollisionHandler that sets the Z height of the collider to a fixed linear offset from the highest detected collision point each frame.

It's intended to implement walking around on a floor of varying height by casting a ray down from the avatar's head.

Definition at line 31 of file collisionHandlerFloor.h.


Member Function Documentation

PN_stdfloat CollisionHandlerFloor::get_max_velocity ( ) const [inline]

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

Definition at line 83 of file collisionHandlerFloor.I.

PN_stdfloat CollisionHandlerFloor::get_offset ( ) const [inline]

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.

Definition at line 36 of file collisionHandlerFloor.I.

PN_stdfloat CollisionHandlerFloor::get_reach ( ) const [inline]

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

Definition at line 58 of file collisionHandlerFloor.I.

bool CollisionHandlerFloor::handle_entries ( ) [protected, virtual]

Called by the parent class after all collisions have been detected, this manages the various collisions and moves around the nodes as necessary.

The return value is normally true, but it may be false to indicate the CollisionTraverser should disable this handler from being called in the future.

Implements CollisionHandlerPhysical.

Definition at line 139 of file collisionHandlerFloor.cxx.

References ClockObject::get_dt(), CollisionEntry::get_from_node_path(), ClockObject::get_global_clock(), CollisionEntry::get_surface_point(), NodePath::get_transform(), CollisionEntry::has_surface_point(), NodePath::set_transform(), and CollisionHandlerPhysical::ColliderDef::updated_transform().

static void CollisionHandlerFloor::init_type ( ) [inline, static]

This function is declared non-inline to work around a compiler bug in g++ 2.96.

Making it inline seems to cause problems in the optimizer.

Reimplemented from CollisionHandlerPhysical.

Definition at line 60 of file collisionHandlerFloor.h.

References CollisionHandlerPhysical::init_type().

void CollisionHandlerFloor::set_max_velocity ( PN_stdfloat  max_velocity) [inline]

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.

Definition at line 71 of file collisionHandlerFloor.I.

void CollisionHandlerFloor::set_offset ( PN_stdfloat  offset) [inline]

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.

Definition at line 24 of file collisionHandlerFloor.I.

void CollisionHandlerFloor::set_reach ( PN_stdfloat  reach) [inline]

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

Definition at line 47 of file collisionHandlerFloor.I.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations