Download and install VPython by going to http://vpython.org/
Here is a gallery of some projects you can do using VPython
from visual import * scene = display(title='Bouncing ball') ball = sphere(pos=(0,5,0), radius=1, color=color.yellow) floor = box(pos=(0,-5,0), length=8, height=0.2, width=4) dt = 0.01 # time step size v = 0.0 # initial velocity while True: # loop forever rate(400) # limit animation rate to 400 loops/sec ball.pos.y = ball.pos.y + v*dt # update y position if ball.pos.y > floor.y + ball.radius: v = v - 9.8*dt # above floor, update velocity else: v = - v # below floor, reverse velocity
Discussion
No comments yet.