CollisionHandlerGravity

from panda3d.core import CollisionHandlerGravity
class CollisionHandlerGravity

Bases: CollisionHandlerPhysical

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.

Inheritance diagram

Inheritance diagram of CollisionHandlerGravity

__init__(*args, **kwargs)
addVelocity()

C++ Interface: add_velocity(const CollisionHandlerGravity self, 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.

*/

add_velocity()

C++ Interface: add_velocity(const CollisionHandlerGravity self, 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.

*/

airborne_height
contact_normal
getAirborneHeight()

C++ Interface: get_airborne_height(CollisionHandlerGravity self)

/**
  • 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.

*/

getClassType()

C++ Interface: get_class_type()

getContactNormal()

C++ Interface: get_contact_normal(CollisionHandlerGravity self)

/**

*/

getGravity()

C++ Interface: get_gravity(CollisionHandlerGravity self)

/**
  • Gets the linear gravity force (always plumb).

*/

getImpactVelocity()

C++ Interface: get_impact_velocity(CollisionHandlerGravity self)

/**
  • 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.

*/

getLegacyMode()

C++ Interface: get_legacy_mode(CollisionHandlerGravity self)

/**
  • returns true if legacy mode is enabled

*/

getMaxVelocity()

C++ Interface: get_max_velocity(CollisionHandlerGravity self)

/**
  • 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()

C++ Interface: get_offset(CollisionHandlerGravity self)

/**
  • 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()

C++ Interface: get_reach(CollisionHandlerGravity self)

/**
  • Returns the reach to add to (or subtract from) the highest collision point

*/

getVelocity()

C++ Interface: get_velocity(CollisionHandlerGravity self)

/**
  • 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()

*/

get_airborne_height()

C++ Interface: get_airborne_height(CollisionHandlerGravity self)

/**
  • 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.

*/

get_class_type()

C++ Interface: get_class_type()

get_contact_normal()

C++ Interface: get_contact_normal(CollisionHandlerGravity self)

/**

*/

get_gravity()

C++ Interface: get_gravity(CollisionHandlerGravity self)

/**
  • Gets the linear gravity force (always plumb).

*/

get_impact_velocity()

C++ Interface: get_impact_velocity(CollisionHandlerGravity self)

/**
  • 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.

*/

get_legacy_mode()

C++ Interface: get_legacy_mode(CollisionHandlerGravity self)

/**
  • returns true if legacy mode is enabled

*/

get_max_velocity()

C++ Interface: get_max_velocity(CollisionHandlerGravity self)

/**
  • 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().

*/

get_offset()

C++ Interface: get_offset(CollisionHandlerGravity self)

/**
  • 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.

*/

get_reach()

C++ Interface: get_reach(CollisionHandlerGravity self)

/**
  • Returns the reach to add to (or subtract from) the highest collision point

*/

get_velocity()

C++ Interface: get_velocity(CollisionHandlerGravity self)

/**
  • 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()

*/

gravity
impact_velocity
isOnGround()

C++ Interface: is_on_ground(CollisionHandlerGravity self)

/**
  • Is the object at rest?

*/

is_on_ground()

C++ Interface: is_on_ground(CollisionHandlerGravity self)

/**
  • Is the object at rest?

*/

max_velocity
offset
on_ground
reach
setGravity()

C++ Interface: set_gravity(const CollisionHandlerGravity self, float gravity)

/**
  • Sets the linear gravity force (always plumb).

*/

setLegacyMode()

C++ Interface: set_legacy_mode(const CollisionHandlerGravity self, 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()

C++ Interface: set_max_velocity(const CollisionHandlerGravity self, 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()

C++ Interface: set_offset(const CollisionHandlerGravity self, 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()

C++ Interface: set_reach(const CollisionHandlerGravity self, float reach)

/**
  • Sets the reach to add to (or subtract from) the highest collision point

*/

setVelocity()

C++ Interface: set_velocity(const CollisionHandlerGravity self, float velocity)

/**
  • Sets the current vertical velocity.

*/

set_gravity()

C++ Interface: set_gravity(const CollisionHandlerGravity self, float gravity)

/**
  • Sets the linear gravity force (always plumb).

*/

set_legacy_mode()

C++ Interface: set_legacy_mode(const CollisionHandlerGravity self, 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

*/

set_max_velocity()

C++ Interface: set_max_velocity(const CollisionHandlerGravity self, 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.

*/

set_offset()

C++ Interface: set_offset(const CollisionHandlerGravity self, 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.

*/

set_reach()

C++ Interface: set_reach(const CollisionHandlerGravity self, float reach)

/**
  • Sets the reach to add to (or subtract from) the highest collision point

*/

set_velocity()

C++ Interface: set_velocity(const CollisionHandlerGravity self, float velocity)

/**
  • Sets the current vertical velocity.

*/

velocity