Panda3D
Loading...
Searching...
No Matches
ProjectileInterval Class Reference
Inheritance diagram for ProjectileInterval:
Interval DirectObject

Public Member Functions

 __init__ (self, node, startPos=None, endPos=None, duration=None, startVel=None, endZ=None, wayPoint=None, timeToWayPoint=None, gravityMult=None, name=None, collNode=None)
 
 privInitialize (self, t)
 
 privInstant (self)
 
 privStep (self, t)
 
 testTrajectory (self)
 
- Public Member Functions inherited from Interval
 __init__ (self, name, duration, openEnded=1)
 
 __repr__ (self, indent=0)
 
 clearToInitial (self)
 
 finish (self)
 
 getDoneEvent (self)
 
 getDuration (self)
 
 getLoop (self)
 
 getName (self)
 
 getOpenEnded (self)
 
 getPlayRate (self)
 
 getState (self)
 
 getT (self)
 
 intervalDone (self)
 
 isPaused (self)
 
 isPlaying (self)
 
 isStopped (self)
 
 loop (self, startT=0.0, endT=-1.0, playRate=1.0)
 
 pause (self)
 
 popupControls (self, tl=None)
 
 privDoEvent (self, t, event)
 
 privFinalize (self)
 
 privInterrupt (self)
 
 privPostEvent (self)
 
 privReverseFinalize (self)
 
 privReverseInitialize (self, t)
 
 privReverseInstant (self)
 
 resume (self, startT=None)
 
 resumeUntil (self, endT)
 
 setDoneEvent (self, event)
 
 setLoop (self, loop=1)
 
 setPlayRate (self, playRate)
 
 setT (self, t)
 
 setupPlay (self, startT, endT, playRate, doLoop)
 
 setupResume (self)
 
 start (self, startT=0.0, endT=-1.0, playRate=1.0)
 
 stepPlay (self)
 
- 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

 collNode = collNode
 
 endPos = endPos
 
int implicitStartPos = 0
 
 node = node
 
 parabola
 
 startPos = startPos
 
 startVel
 
 trajectoryArgs = args
 
int zAcc = -self.gravity
 
- Public Attributes inherited from Interval
float currT = 0.0
 
 doneEvent = None
 
 duration = max(duration, 0.0)
 
 es
 
 name = name
 
 openEnded = openEnded
 
 pname = name.split('-', 1)[0]
 
 pstats = None
 
list setTHooks = []
 
 state = CInterval.SInitial
 

Static Public Attributes

int gravity = 32.
 
int projectileIntervalNum = 1
 
- Static Public Attributes inherited from Interval
 notify = directNotify.newCategory("Interval")
 
int playbackCounter = 0
 
- 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
 

Additional Inherited Members

- Protected Member Functions inherited from DirectObject
 _addTask (self, task)
 
 _clearTask (self, task)
 
- Protected Attributes inherited from DirectObject
dict _taskList = {}
 
- Properties inherited from Interval
 done_event = property(getDoneEvent, setDoneEvent)
 
 open_ended = property(getOpenEnded)
 
 play_rate = property(getPlayRate, setPlayRate)
 
 stopped = property(isStopped)
 
 t = property(getT, setT)
 

Detailed Description

ProjectileInterval class: moves a nodepath through the trajectory
of a projectile under the influence of gravity

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
node,
startPos = None,
endPos = None,
duration = None,
startVel = None,
endZ = None,
wayPoint = None,
timeToWayPoint = None,
gravityMult = None,
name = None,
collNode = None )
You may specify several different sets of input parameters.
(If startPos is not provided, it will be obtained from the node's
position at the time that the interval is first started. Note that
in this case you must provide a duration of some kind.)

# go from startPos to endPos in duration seconds
startPos, endPos, duration
# given a starting velocity, go for a specific time period
startPos, startVel, duration
# given a starting velocity, go until you hit a given Z plane
startPos, startVel, endZ
# pass through wayPoint at time 'timeToWayPoint'. Go until
# you hit a given Z plane
startPos, wayPoint, timeToWayPoint, endZ

You may alter gravity by providing a multiplier in 'gravityMult'.
'2.' will make gravity twice as strong, '.5' half as strong.
'-1.' will reverse gravity

If collNode is not None, it should be an empty CollisionNode
which will be filled with an appropriate CollisionParabola
when the interval starts.  This CollisionParabola will be set
to match the interval's parabola, and its t1, t2 values will
be updated automatically as the interval plays.  It will *not*
be automatically removed from the node when the interval
finishes.

Member Function Documentation

◆ privInitialize()

privInitialize ( self,
t )

Reimplemented from Interval.

◆ privInstant()

privInstant ( self)

Reimplemented from Interval.

◆ privStep()

privStep ( self,
t )

Reimplemented from Interval.

◆ testTrajectory()

testTrajectory ( self)

Member Data Documentation

◆ collNode

collNode = collNode

◆ endPos

endPos = endPos

◆ gravity

int gravity = 32.
static

◆ implicitStartPos

int implicitStartPos = 0

◆ node

node = node

◆ parabola

parabola
Initial value:
= LParabola(VBase3(0, 0, 0.5 * self.zAcc),
self.startVel,
self.startPos)

◆ projectileIntervalNum

int projectileIntervalNum = 1
static

◆ startPos

startPos = startPos

◆ startVel

startVel
Initial value:
= calcStartVel(self.startPos, self.endPos,
self.duration, self.zAcc)

◆ trajectoryArgs

trajectoryArgs = args

◆ zAcc

zAcc = -self.gravity