Panda3D
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
DistancePhasedNode Class Reference
Inheritance diagram for DistancePhasedNode:
DirectObject BufferedDistancePhasedNode

Public Member Functions

def __init__
 
def __del__
 
def __repr__
 
def __str__
 
def cleanup
 
def reset
 
def setPhase
 
def setPhaseCollideMask
 
- Public Member Functions inherited from DirectObject
def __init__
 
def accept
 
def acceptOnce
 
def addTask
 
def detectLeaks
 
def doMethodLater
 
def getAllAccepting
 
def ignore
 
def ignoreAll
 
def isAccepting
 
def isIgnoring
 
def removeAllTasks
 
def removeTask
 

Public Attributes

 autoCleanup
 
 cTrav
 
 enterPrefix
 
 exitPrefix
 
 fromCollideNode
 
 phaseCollideMask
 
 phaseParamList
 
 phaseParamMap
 

Static Public Attributes

tuple notify = directNotify.newCategory("DistancePhasedObject")
 

Detailed Description

This class defines a PhasedObject,NodePath object that will handle the phasing
of an object in the scene graph according to its distance from some 
other collider object(such as an avatar).

Since it's a NodePath, you can parent it to another object in the
scene graph, or even inherit from this class to get its functionality.

What you will need to define to use this class:
 - The distances at which you want the phases to load/unload
 - Whether you want the object to clean itself up or not when
   exitting the largest distance sphere
 - What the load/unload functions are
 - What sort of events to listen for when a collision occurs
 - (Optional) A collision bitmask for the phase collision spheres
 - (Optional) A 'from' collision node to collide into our 'into' spheres

You specify the distances and function names by the phaseParamMap
parameter to __init__().  For example:

phaseParamMap = {'Alias': distance, ...}
...
def loadPhaseAlias(self):
    pass
def unloadPhaseAlias(self):
    pass

If the 'fromCollideNode' is supplied, we will set up our own
traverser and only traverse below this node.  It will send out
events of the form '<enterPrefix>%in' and '<exitPrefix>%in' in
order to match the main collision traverser's patterns.  Note
that this will only be used after a reset or phase change in
order to fully transition to the correct phase in a single pass.
Most of the time, it will be reacting to events from the main
collision traverser.    

IMPORTANT!: The following only applies when autoCleanup == True:
            If you unload the last phase, by either calling
            cleanup() or by exitting the last phase's distance,
            you will need to explicitly call reset() to get the
            distance phasing to work again. This was done so if
            either this node or the collider is removed from the
            scene graph(eg. avatar teleport), the phased object
            will clean itself up automatically.

Constructor & Destructor Documentation

def __init__ (   self,
  name,
  phaseParamMap = {},
  autoCleanup = True,
  enterPrefix = 'enter',
  exitPrefix = 'exit',
  phaseCollideMask = BitMask32.allOn(),
  fromCollideNode = None 
)
def __del__ (   self)

Member Function Documentation

def __repr__ (   self)
def __str__ (   self)
def cleanup (   self)
Disables all collisions.
Ignores all owned event listeners.
Unloads all unloaded phases.        
def reset (   self)
Unloads all loaded phases and puts the phase node
in the startup state is if it had just been initialized.
def setPhase (   self,
  aPhase 
)
See PhasedObject.setPhase()
def setPhaseCollideMask (   self,
  mask 
)
Sets the intoCollideMasks for our collision spheres.

Member Data Documentation

autoCleanup
cTrav
enterPrefix
exitPrefix
fromCollideNode
tuple notify = directNotify.newCategory("DistancePhasedObject")
static
phaseCollideMask
phaseParamList
phaseParamMap