direct.controls.GravityWalker
from direct.controls.GravityWalker import GravityWalker
GravityWalker.py is for avatars.
A walker control such as this one provides:
creation of the collision nodes
handling the keyboard and mouse input for avatar movement
moving the avatar
it does not:
play sounds
play animations
although it does send messages that allow a listener to play sounds or animations based on walker events.
Inheritance diagram
- class GravityWalker(gravity=64.348, standableGround=0.707, hardLandingForce=16.0, legacyLifter=False)[source]
Bases:
DirectObject
- DiagonalFactor = 0.7071067811865476
- __init__(self, gravity=64.348, standableGround=0.707, hardLandingForce=16.0, legacyLifter=False)[source]
- earlyEventSphere = 0
- initializeCollisions(self, collisionTraverser, avatarNodePath, avatarRadius=1.4, floorOffset=1.0, reach=1.0)[source]
- floorOffset is how high the avatar can reach. I.e. if the avatar
walks under a ledge that is <= floorOffset above the ground (a double floor situation), the avatar will step up on to the ledge (instantly).
Set up the avatar collisions
- notify = <direct.directnotify.Notifier.Notifier object>
- oneTimeCollide(self)[source]
Makes one quick collision pass for the avatar, for instance as a one-time straighten-things-up operation after collisions have been disabled.
- placeOnFloor(self)[source]
Make a reasonable effor to place the avatar on the ground. For example, this is useful when switching away from the current walker.
- setMayJump(self, task)[source]
This function’s use is internal to this class (maybe I’ll add the __ someday). Anyway, if you want to enable or disable jumping in a general way see the ControlManager (don’t use this).
- wantDebugIndicator = 0
- wantFloorSphere = 0