Skip to content

Instantly share code, notes, and snippets.

@rhettallain
Last active January 4, 2016 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhettallain/8581517 to your computer and use it in GitHub Desktop.
Save rhettallain/8581517 to your computer and use it in GitHub Desktop.
A simple vpython program with a moving ball
from visual import *
t=0
dt=0.01
g=vector(0,-9.8,0)
ball = sphere(pos=(-1,1,0), radius=.15, color=color.cyan)
ball.v=vector(0.1,0,0)
floor=box(pos=(0,0,0), length=2, width=1, height=.1, color=color.blue)
while ball.pos.x<1:
rate(100)
ball.pos=ball.pos+ball.v*dt
t=t+dt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment