Panda3D
Loading...
Searching...
No Matches
GravityWalker Class Reference
Inheritance diagram for GravityWalker:
DirectObject BattleWalker TwoDWalker

Public Member Functions

 __init__ (self, gravity=64.348, standableGround=0.707, hardLandingForce=16.0, legacyLifter=False)
 
 addBlastForce (self, vector)
 
 debugPrint (self, message)
 
 deleteCollisions (self)
 
 disableAvatarControls (self)
 
 displayDebugInfo (self)
 
 doDeltaPos (self)
 
 enableAvatarControls (self)
 
 flushEventHandlers (self)
 
 getAirborneHeight (self)
 
 getCollisionsActive (self)
 
 getGravity (self, gravity)
 
 getIsAirborne (self)
 
 getSpeeds (self)
 
 getVelocity (self)
 
 handleAvatarControls (self, task)
 
 initializeCollisions (self, collisionTraverser, avatarNodePath, avatarRadius=1.4, floorOffset=1.0, reach=1.0)
 
 oneTimeCollide (self)
 
 placeOnFloor (self)
 
 reset (self)
 
 setAirborneHeightFunc (self, unused_parameter)
 
 setAvatar (self, avatar)
 
 setAvatarPhysicsIndicator (self, indicator)
 
 setCollisionRayHeight (self, height)
 
 setCollisionsActive (self, active=1)
 
 setFloorBitMask (self, bitMask)
 
 setGravity (self, gravity)
 
 setMayJump (self, task)
 
 setPriorParentVector (self)
 
 setTag (self, key, value)
 
 setupEventSphere (self, bitmask, avatarRadius)
 
 setupFloorSphere (self, bitmask, avatarRadius)
 
 setupRay (self, bitmask, floorOffset, reach)
 
 setupWallSphere (self, bitmask, avatarRadius)
 
 setWalkSpeed (self, forward, jump, reverse, rotate)
 
 setWallBitMask (self, bitMask)
 
 startJumpDelay (self, delay)
 
 swapFloorBitMask (self, oldMask, newMask)
 
- Public Member Functions inherited from DirectObject
 __init__ (self)
 
 accept (self, event, method, extraArgs=[])
 
 acceptOnce (self, event, method, extraArgs=[])
 
 addTask (self, *args, **kwargs)
 
 detectLeaks (self)
 
 doMethodLater (self, *args, **kwargs)
 
 getAllAccepting (self)
 
 ignore (self, event)
 
 ignoreAll (self)
 
 isAccepting (self, event)
 
 isIgnoring (self, event)
 
 removeAllTasks (self)
 
 removeTask (self, taskOrName)
 

Public Attributes

 avatar = avatar
 
int avatarControlForwardSpeed = 0
 
int avatarControlJumpForce = 0
 
int avatarControlReverseSpeed = 0
 
int avatarControlRotateSpeed = 0
 
 avatarNodePath = CollisionHandlerPusher()
 
 avatarRadius = avatarRadius
 
 cEventSphereNodePath = cSphereNodePath
 
 cFloorSphereNodePath = cSphereNodePath
 
int collisionsActive = 0
 
 controlsTask = None
 
 cRay = CollisionRay(0.0, 0.0, CollisionHandlerRayStart, 0.0, 0.0, -1.0)
 
 cRayNodePath = self.avatarNodePath.attachNewNode(cRayNode)
 
 cTrav = collisionTraverser
 
 cWallSphereNodePath = cSphereNodePath
 
 event = CollisionHandlerEvent()
 
int falling = 0
 
 floorBitmask = bitMask
 
 getAirborneHeight = None
 
int highMark = 0
 
 indicatorTask = None
 
int isAirborne = 0
 
 jumpDelayTask = None
 
 lifter = CollisionHandlerGravity()
 
int mayJump = 1
 
int moving = 0
 
int needToDeltaPos = 0
 
 physVelocityIndicator = None
 
 priorParent = Vec3(0)
 
 pusher = CollisionHandlerFluidPusher()
 
 pusherFloor
 
 pusherFloorhandler = CollisionHandlerPusher()
 
float rotationSpeed = 0.0
 
float slideSpeed = 0.0
 
float speed = 0.0
 
 vel = Vec3(0.0)
 
 wallBitmask = bitMask
 

Static Public Attributes

int DiagonalFactor = math.sqrt(2.) / 2.
 
 earlyEventSphere = ConfigVariableBool('early-event-sphere', False)
 
 notify = directNotify.newCategory("GravityWalker")
 
 wantDebugIndicator = ConfigVariableBool('want-avatar-physics-indicator', False)
 
 wantFloorSphere = ConfigVariableBool('want-floor-sphere', False)
 
- Static Public Attributes inherited from DirectObject
 accept_once = acceptOnce
 
 add_task = addTask
 
 detect_leaks = detectLeaks
 
 do_method_later = doMethodLater
 
 get_all_accepting = getAllAccepting
 
 ignore_all = ignoreAll
 
 is_accepting = isAccepting
 
 is_ignoring = isIgnoring
 
 remove_all_tasks = removeAllTasks
 
 remove_task = removeTask
 

Protected Attributes

 _legacyLifter = legacyLifter
 
- Protected Attributes inherited from DirectObject
dict _taskList = {}
 

Additional Inherited Members

- Protected Member Functions inherited from DirectObject
 _addTask (self, task)
 
 _clearTask (self, task)
 

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
gravity = 64.348,
standableGround = 0.707,
hardLandingForce = 16.0,
legacyLifter = False )

Member Function Documentation

◆ addBlastForce()

addBlastForce ( self,
vector )

◆ debugPrint()

debugPrint ( self,
message )
for debugging

◆ deleteCollisions()

deleteCollisions ( self)

◆ disableAvatarControls()

disableAvatarControls ( self)
Ignore the arrow keys, etc.

◆ displayDebugInfo()

displayDebugInfo ( self)
For debug use.

◆ doDeltaPos()

doDeltaPos ( self)

◆ enableAvatarControls()

enableAvatarControls ( self)
Activate the arrow keys, etc.

◆ flushEventHandlers()

flushEventHandlers ( self)

◆ getAirborneHeight()

getAirborneHeight ( self)

◆ getCollisionsActive()

getCollisionsActive ( self)

◆ getGravity()

getGravity ( self,
gravity )

◆ getIsAirborne()

getIsAirborne ( self)

◆ getSpeeds()

getSpeeds ( self)

Reimplemented in BattleWalker.

◆ getVelocity()

getVelocity ( self)

◆ handleAvatarControls()

handleAvatarControls ( self,
task )
Check on the arrow keys and update the avatar.

Reimplemented in BattleWalker, BattleWalker, and TwoDWalker.

◆ initializeCollisions()

initializeCollisions ( self,
collisionTraverser,
avatarNodePath,
avatarRadius = 1.4,
floorOffset = 1.0,
reach = 1.0 )
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

◆ oneTimeCollide()

oneTimeCollide ( self)
Makes one quick collision pass for the avatar, for instance as
a one-time straighten-things-up operation after collisions
have been disabled.

◆ placeOnFloor()

placeOnFloor ( self)
Make a reasonable effor to place the avatar on the ground.
For example, this is useful when switching away from the
current walker.

◆ reset()

reset ( self)

◆ setAirborneHeightFunc()

setAirborneHeightFunc ( self,
unused_parameter )

◆ setAvatar()

setAvatar ( self,
avatar )

◆ setAvatarPhysicsIndicator()

setAvatarPhysicsIndicator ( self,
indicator )
indicator is a NodePath

◆ setCollisionRayHeight()

setCollisionRayHeight ( self,
height )

◆ setCollisionsActive()

setCollisionsActive ( self,
active = 1 )

◆ setFloorBitMask()

setFloorBitMask ( self,
bitMask )

◆ setGravity()

setGravity ( self,
gravity )

◆ setMayJump()

setMayJump ( self,
task )
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()

setPriorParentVector ( self)

◆ setTag()

setTag ( self,
key,
value )

◆ setupEventSphere()

setupEventSphere ( self,
bitmask,
avatarRadius )
Set up the collision sphere

◆ setupFloorSphere()

setupFloorSphere ( self,
bitmask,
avatarRadius )
Set up the collision sphere

◆ setupRay()

setupRay ( self,
bitmask,
floorOffset,
reach )

◆ setupWallSphere()

setupWallSphere ( self,
bitmask,
avatarRadius )
Set up the collision sphere

◆ setWalkSpeed()

setWalkSpeed ( self,
forward,
jump,
reverse,
rotate )

◆ setWallBitMask()

setWallBitMask ( self,
bitMask )

◆ startJumpDelay()

startJumpDelay ( self,
delay )

◆ swapFloorBitMask()

swapFloorBitMask ( self,
oldMask,
newMask )

Member Data Documentation

◆ _legacyLifter

_legacyLifter = legacyLifter
protected

◆ avatar

avatar = avatar

◆ avatarControlForwardSpeed

int avatarControlForwardSpeed = 0

◆ avatarControlJumpForce

avatarControlJumpForce = 0

◆ avatarControlReverseSpeed

int avatarControlReverseSpeed = 0

◆ avatarControlRotateSpeed

int avatarControlRotateSpeed = 0

◆ avatarNodePath

avatarNodePath = CollisionHandlerPusher()

◆ avatarRadius

avatarRadius = avatarRadius

◆ cEventSphereNodePath

cEventSphereNodePath = cSphereNodePath

◆ cFloorSphereNodePath

cFloorSphereNodePath = cSphereNodePath

◆ collisionsActive

collisionsActive = 0

◆ controlsTask

controlsTask = None

◆ cRay

cRay = CollisionRay(0.0, 0.0, CollisionHandlerRayStart, 0.0, 0.0, -1.0)

◆ cRayNodePath

cRayNodePath = self.avatarNodePath.attachNewNode(cRayNode)

◆ cTrav

cTrav = collisionTraverser

◆ cWallSphereNodePath

cWallSphereNodePath = cSphereNodePath

◆ DiagonalFactor

int DiagonalFactor = math.sqrt(2.) / 2.
static

◆ earlyEventSphere

earlyEventSphere = ConfigVariableBool('early-event-sphere', False)
static

◆ event

event = CollisionHandlerEvent()

◆ falling

falling = 0

◆ floorBitmask

floorBitmask = bitMask

◆ getAirborneHeight

getAirborneHeight = None

◆ highMark

int highMark = 0

◆ indicatorTask

indicatorTask = None

◆ isAirborne

isAirborne = 0

◆ jumpDelayTask

jumpDelayTask = None

◆ lifter

lifter = CollisionHandlerGravity()

◆ mayJump

mayJump = 1

◆ moving

int moving = 0

◆ needToDeltaPos

int needToDeltaPos = 0

◆ notify

notify = directNotify.newCategory("GravityWalker")
static

◆ physVelocityIndicator

physVelocityIndicator = None

◆ priorParent

priorParent = Vec3(0)

◆ pusher

pusher = CollisionHandlerFluidPusher()

◆ pusherFloor

pusherFloor

◆ pusherFloorhandler

pusherFloorhandler = CollisionHandlerPusher()

◆ rotationSpeed

rotationSpeed = 0.0

◆ slideSpeed

slideSpeed = 0.0

◆ speed

speed = 0.0

◆ vel

vel = Vec3(0.0)

◆ wallBitmask

wallBitmask = bitMask

◆ wantDebugIndicator

wantDebugIndicator = ConfigVariableBool('want-avatar-physics-indicator', False)
static

◆ wantFloorSphere

wantFloorSphere = ConfigVariableBool('want-floor-sphere', False)
static