Panda3D
|
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 <pandadoc.hpp>
Public Member Functions | |
__init__ () | |
addVelocity (float velocity) | |
Adds the sepcified amount to the current velocity. | |
float | getAirborneHeight () |
Return the height of the object from the ground. | |
const LVector3 | getContactNormal () |
float | getGravity () |
Gets the linear gravity force (always plumb). | |
float | getImpactVelocity () |
How hard did the object hit the ground. | |
bool | getLegacyMode () |
returns true if legacy mode is enabled | |
float | getMaxVelocity () |
Retrieves the maximum speed at which the object will be allowed to descend towards a floor below it, in units per second. | |
float | getOffset () |
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. | |
float | getReach () |
Returns the reach to add to (or subtract from) the highest collision point. | |
float | getVelocity () |
Gets the current vertical velocity. | |
bool | isOnGround () |
Is the object at rest? | |
readDatagram (DatagramIterator source) | |
Restores the object state from the given datagram, previously obtained using getstate. | |
setGravity (float gravity) | |
Sets the linear gravity force (always plumb). | |
setLegacyMode (bool legacy_mode) | |
Enables old behavior required by Toontown (Sellbot Factory lava room is good test case, lava and conveyor belt specifically). | |
setMaxVelocity (float max_vel) | |
Sets the maximum speed at which the object will be allowed to descend towards a floor below it, in units per second. | |
setOffset (float 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. | |
setReach (float reach) | |
Sets the reach to add to (or subtract from) the highest collision point. | |
setVelocity (float velocity) | |
Sets the current vertical velocity. | |
writeDatagram (Datagram destination) | |
Serializes this object, to implement pickle support. | |
![]() | |
object | __reduce__ () |
__setstate__ (VectorUchar data, object nodepaths) | |
addCollider (const NodePath collider, const NodePath target) | |
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. | |
addCollider (const NodePath collider, const NodePath target, DriveInterface drive_interface) | |
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. | |
clearCenter () | |
Clears the center NodePath specified with set_center. | |
clearColliders () | |
Completely empties the list of colliders this handler knows about. | |
const NodePath | getCenter () |
Returns the NodePath specified with set_center, or the empty NodePath if nothing has been specified. | |
bool | hasCenter () |
Returns true if a NodePath has been specified with set_center(), false otherwise. | |
bool | hasCollider (const NodePath collider) |
Returns true if the handler knows about the indicated collider, false otherwise. | |
bool | hasContact () |
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. | |
bool | removeCollider (const NodePath collider) |
Removes the collider from the list of colliders that this handler knows about. | |
setCenter (const NodePath center) | |
Specifies an arbitrary NodePath that the handler is always considered to be facing. | |
![]() | |
__init__ () | |
The default CollisionHandlerEvent will throw no events. | |
__init__ (const CollisionHandlerEvent) | |
object | __reduce__ () |
__setstate__ (VectorUchar data) | |
addAgainPattern (str again_pattern) | |
Adds the pattern string that indicates how the event names are generated when a collision between two particular nodes is still detected. | |
addInPattern (str in_pattern) | |
Adds a pattern string to the list of events that will be generated in response to a collision. | |
addOutPattern (str out_pattern) | |
Adds the pattern string that indicates how the event names are generated when a collision between two particular nodes is no longer detected. | |
clear () | |
Empties the list of elements that all colliders are known to be colliding with. | |
clearAgainPatterns () | |
Removes all of the previously-added in patterns. | |
clearInPatterns () | |
Removes all of the previously-added in patterns. | |
clearOutPatterns () | |
Removes all of the previously-added in patterns. | |
flush () | |
Same as clear() except "out" events are thrown. | |
str | getAgainPattern (int n) |
Returns the nth pattern string that indicates how the event names are generated for each collision detected. | |
list | getAgainPatterns () |
str | getInPattern (int n) |
Returns the nth pattern string that indicates how the event names are generated for each collision detected. | |
list | getInPatterns () |
int | getNumAgainPatterns () |
Returns the number of in pattern strings that have been added. | |
int | getNumInPatterns () |
Returns the number of in pattern strings that have been added. | |
int | getNumOutPatterns () |
Returns the number of in pattern strings that have been added. | |
str | getOutPattern (int n) |
Returns the nth pattern string that indicates how the event names are generated for each collision detected. | |
list | getOutPatterns () |
readDatagram (DatagramIterator source) | |
Restores the object state from the given datagram, previously obtained using getstate. | |
setAgainPattern (str again_pattern) | |
This method is deprecated; it completely replaces all the in patterns that have previously been set with the indicated pattern. | |
setInPattern (str in_pattern) | |
This method is deprecated; it completely replaces all the in patterns that have previously been set with the indicated pattern. | |
setOutPattern (str out_pattern) | |
This method is deprecated; it completely replaces all the in patterns that have previously been set with the indicated pattern. | |
writeDatagram (Datagram destination) | |
Serializes this object, to implement pickle support. | |
![]() | |
__init__ (const CollisionHandler) | |
![]() | |
TypeHandle | getType () |
int | getTypeIndex () |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
bool | isExactType (TypeHandle handle) |
Returns true if the current object is the indicated type exactly. | |
bool | isOfType (TypeHandle handle) |
Returns true if the current object is or derives from the indicated type. | |
![]() | |
int | getRefCount () |
Returns the current reference count. | |
ref () | |
Explicitly increments the reference count. | |
bool | testRefCountIntegrity () |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | testRefCountNonzero () |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. | |
bool | unref () |
Explicitly decrements the reference count. | |
Static Public Member Functions | |
static TypeHandle | getClassType () |
![]() | |
static TypeHandle | getClassType () |
![]() | |
static TypeHandle | getClassType () |
![]() | |
static TypeHandle | getClassType () |
![]() | |
static TypeHandle | getClassType () |
![]() | |
static TypeHandle | getClassType () |
![]() | |
static TypeHandle | getClassType () |
Public Attributes | |
float | airborne_height |
Return the height of the object from the ground. | |
const LVector3 | contact_normal |
float | gravity |
Gets the linear gravity force (always plumb). | |
float | impact_velocity |
How hard did the object hit the ground. | |
float | max_velocity |
Retrieves the maximum speed at which the object will be allowed to descend towards a floor below it, in units per second. | |
float | offset |
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. | |
bool | on_ground |
Is the object at rest? | |
float | reach |
Returns the reach to add to (or subtract from) the highest collision point. | |
float | velocity |
Gets the current vertical velocity. | |
![]() | |
const NodePath | center |
Returns the NodePath specified with set_center, or the empty NodePath if nothing has been specified. | |
![]() | |
String | again_patterns [] |
Returns the nth pattern string that indicates how the event names are generated for each collision detected. | |
String | in_patterns [] |
Returns the nth pattern string that indicates how the event names are generated for each collision detected. | |
String | out_patterns [] |
Returns the nth pattern string that indicates how the event names are generated for each collision detected. | |
![]() | |
TypeHandle | type |
Returns the TypeHandle representing this object's type. | |
![]() | |
int | ref_count |
The current reference count. | |
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.
__init__ | ( | ) |
addVelocity | ( | float | velocity | ) |
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.
float getAirborneHeight | ( | ) |
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.
|
static |
const LVector3 getContactNormal | ( | ) |
float getGravity | ( | ) |
Gets the linear gravity force (always plumb).
float getImpactVelocity | ( | ) |
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_ground() and when that is true, call get_impact_velocity(). Normally I avoid polling, but we are calling is_on_ground() frequently anyway.
bool getLegacyMode | ( | ) |
returns true if legacy mode is enabled
float getMaxVelocity | ( | ) |
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().
float getOffset | ( | ) |
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.
float getReach | ( | ) |
Returns the reach to add to (or subtract from) the highest collision point.
float getVelocity | ( | ) |
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()
bool isOnGround | ( | ) |
Is the object at rest?
readDatagram | ( | DatagramIterator | source | ) |
Restores the object state from the given datagram, previously obtained using getstate.
setGravity | ( | float | gravity | ) |
Sets the linear gravity force (always plumb).
setLegacyMode | ( | bool | legacy_mode | ) |
Enables old behavior required by Toontown (Sellbot Factory lava room is good test case, lava and conveyor belt specifically).
Behavior is to throw enter/exit events only for floor that the toon is in contact with
setMaxVelocity | ( | float | max_vel | ) |
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 | ( | float | 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.
setReach | ( | float | reach | ) |
Sets the reach to add to (or subtract from) the highest collision point.
setVelocity | ( | float | velocity | ) |
Sets the current vertical velocity.
writeDatagram | ( | Datagram | destination | ) |
Serializes this object, to implement pickle support.
float airborne_height |
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.
const LVector3 contact_normal |
float gravity |
Gets the linear gravity force (always plumb).
float impact_velocity |
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_ground() and when that is true, call get_impact_velocity(). Normally I avoid polling, but we are calling is_on_ground() frequently anyway.
float max_velocity |
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().
float offset |
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.
bool on_ground |
Is the object at rest?
float reach |
Returns the reach to add to (or subtract from) the highest collision point.
float velocity |
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()