direct.controls.PhysicsWalker

from direct.controls.PhysicsWalker import PhysicsWalker

PhysicsWalker.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.PhysicsWalker

class PhysicsWalker(gravity=-32.174, standableGround=0.707, hardLandingForce=16.0)[source]

Bases: direct.showbase.DirectObject.DirectObject

__init__(self, gravity=-32.174, standableGround=0.707, hardLandingForce=16.0)[source]
addBlastForce(self, vector)[source]
avatarPhysicsIndicator(self, task)[source]
debugPrint(self, message)[source]

for debugging

deleteCollisions(self)[source]
determineHeight(self)[source]

returns the height of the avatar above the ground. If there is no floor below the avatar, 0.0 is returned. aka get airborne height.

disableAvatarControls(self)[source]

Ignore the arrow keys, etc.

displayDebugInfo(self)[source]

For debug use.

doDeltaPos(self)[source]
enableAvatarControls(self)[source]

Activate the arrow keys, etc.

flushEventHandlers(self)[source]
getCollisionsActive(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, wallBitmask, floorBitmask, avatarRadius=1.4, floorOffset=1.0, reach=1.0)[source]

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 effort to place the avatar on the ground. For example, this is useful when switching away from the current walker.

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

indicator is a NodePath

setCollisionsActive(self, active=1)[source]
setPriorParentVector(self)[source]
setWalkSpeed(self, forward, jump, reverse, rotate)[source]
setupAvatarPhysicsIndicator(self)[source]
setupPhysics(self, avatarNodePath)[source]
setupRay(self, floorBitmask, floorOffset)[source]
setupSphere(self, bitmask, avatarRadius)[source]

Set up the collision sphere

useHeightRay = 0
useLifter = 0
wantDebugIndicator = 0