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

Inheritance diagram of direct.controls.GravityWalker

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]
addBlastForce(self, vector)[source]
debugPrint(self, message)[source]

for debugging

deleteCollisions(self)[source]
disableAvatarControls(self)[source]

Ignore the arrow keys, etc.

displayDebugInfo(self)[source]

For debug use.

doDeltaPos(self)[source]
earlyEventSphere = 0
enableAvatarControls(self)[source]

Activate the arrow keys, etc.

flushEventHandlers(self)[source]
getAirborneHeight(self)[source]
getCollisionsActive(self)[source]
getGravity(self, gravity)[source]
getIsAirborne(self)[source]
getSpeeds(self)[source]
getVelocity(self)[source]
handleAvatarControls(self, task)[source]

Check on the arrow keys and update the avatar.

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.

reset(self)[source]
setAirborneHeightFunc(self, unused_parameter)[source]
setAvatar(self, avatar)[source]
setAvatarPhysicsIndicator(self, indicator)[source]

indicator is a NodePath

setCollisionRayHeight(self, height)[source]
setCollisionsActive(self, active=1)[source]
setFloorBitMask(self, bitMask)[source]
setGravity(self, gravity)[source]
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).

setPriorParentVector(self)[source]
setTag(self, key, value)[source]
setWalkSpeed(self, forward, jump, reverse, rotate)[source]
setWallBitMask(self, bitMask)[source]
setupEventSphere(self, bitmask, avatarRadius)[source]

Set up the collision sphere

setupFloorSphere(self, bitmask, avatarRadius)[source]

Set up the collision sphere

setupRay(self, bitmask, floorOffset, reach)[source]
setupWallSphere(self, bitmask, avatarRadius)[source]

Set up the collision sphere

startJumpDelay(self, delay)[source]
swapFloorBitMask(self, oldMask, newMask)[source]
wantDebugIndicator = 0
wantFloorSphere = 0