Home    Features    Download    Screenshots    Manual    Reference    Forums    License    Contact   
 
  Panda3D Manual: Projectile Intervals
  <<prev top next>>     

Projectile intervals are used to move a nodepath through the trajectory of a projectile under the influence of gravity.

myInterval = ProjectileInterval(<Node Path>,
  startPos = Point3(X,Y,Z), endPos = Point3(X,Y,Z),
  duration = <Time in seconds>, startVel = Point3(X,Y,Z),
  endZ = Point3(X,Y,Z), gravityMult = <multiplier>, name = <Name>)

All parameters don't have to be specified. Here are a combination of parameters that will allow you to create a projectile interval. (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.)

  • startPos, endPos, duration - go from startPos to endPos in duration seconds
  • startPos, startVel, duration - given a starting velocity, go for a specific time period
  • startPos, startVel, endZ - given a starting velocity, go until you hit a given Z plane

In addition 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.

Here's a little snippet of code that will demonstrate projectile intervals:

camera.setPos(0,-45,0)

# load the ball model
self.ball = loader.loadModel("smiley")
self.ball.reparentTo(render)
self.ball.setPos(-15,0,0)

# setup the projectile interval
self.trajectory = ProjectileInterval(self.ball,
                                     startPos = Point3(-15,0,0),
                                     endPos = Point3(15,0, 0), duration = 1)
self.trajectory.loop()
  <<prev top next>>     
.
screenshot
Psychedelic Flythrough of the Mind of a Computer
screenshot
Blackout: a game using high-end lighting for ambiance.
screenshot
Improvisational acting techniques are used to improve character behavior