• Register

Panda3D is a game engine, a framework for 3D rendering and game development for Python and C++ programs. Panda3D is Open Source and free for any purpose, including commercial ventures, thanks to its liberal license. Go ahead and grab it here. To learn more about Panda3D's capabilities, visit the gallery and the feature list. To learn how to use Panda3D, check the documentation resources. If you get stuck, ask for help on the forums, our community is very active.

Post tutorial Report 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

Your comment will be anonymous unless you join the community. Or sign in with your social account: