• Register
Post tutorial RSS Panda3D Parabolic Trajectory

In this video i give a demonstration on how to make an object travel in an arc using the quadratic formula.

Posted by on - Basic Design/Concepts

This video is about moving something in an arc. The example doesnt work in every scenario but i tried to make it easy to understand for anyone watching. The program calculates two endpoints using the quadratic formula and moves a model from the x coordinate of 0 to the distance between the two endpoints.

PandArc

The height of the model is this code:

XPlace=self["BuiltInBall1"].getX()

z=a*(XPlace)**2+b*(XPlace)+c

In this example XPlace is the name of whatever the objects x coordinate is in the program.

Whatever the object is will be moved horizontally by this code:

self["BuiltInBall1"].setPos(self["BuiltInBall1"].getX()+0.01,0,z)

This part of the program may be the most important, the object is moved by a small amount depending on how fast the user wants to move it. This code is repeated by Panda3D calling a loop that is executed every frame, and the object is moved as long as the x coordinate of the object is less than the distance between the arc's two endpoints. When the object is at the maximum distance the function stops being called and its removed from Panda3D's task manager loop.

If you would like to watch the video it is here:

Hope you found this useful!

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Related Engines
Panda3d
Panda3d BSD
Related Groups
Entertainment Technology Center
Entertainment Technology Center Developer & Publisher