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: DirectObject

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

for debugging

deleteCollisions()[source]
determineHeight()[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()[source]

Ignore the arrow keys, etc.

displayDebugInfo()[source]

For debug use.

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

Activate the arrow keys, etc.

flushEventHandlers()[source]
getCollisionsActive()[source]
getSpeeds()[source]
getVelocity()[source]
handleAvatarControls(task)[source]

Check on the arrow keys and update the avatar.

initializeCollisions(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()[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()[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()[source]
setAirborneHeightFunc(getAirborneHeight)[source]
setAvatar(avatar)[source]
setAvatarPhysicsIndicator(indicator)[source]

indicator is a NodePath

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

Set up the collision sphere

useHeightRay = 0
useLifter = 0
wantDebugIndicator = 0