from visual import * scene.width = 800 scene.height = 600 ball = sphere(pos=(-110,4,0), color=color.red) ball.radius = 10 ball.velocity = vector(85,50,60) xaxis = arrow(pos=(-110,0,0),axis=(250,0,0),shaftwidth=0.5) xlabel = label(pos=xaxis.pos+vector(225,0,0), text='x', xoffset=0, yoffset=10,zoffset=10, height=20, line = 0, box = 0) yaxis = arrow(pos=(-110,0,0),axis=(0,250,0),shaftwidth=0.51) ylabel = label(pos=yaxis.pos+vector(0,225,0), text='y', xoffset=10, yoffset=0,height=20, line = 0, box = 0) zaxis = arrow(pos=(-110,0,0),axis=(0,0,250),shaftwidth=0.51) zlabel = label(pos=xaxis.pos+vector(0,0,225), text='z', xoffset=10, yoffset=10,zoffset = 0,height=20, line = 0, box = 0) scene.autoscale = 0 dt = 0.01 g = 9.81 ax = 0. az = 0. #######################Here is where the curve gets created!################ ball.trajectory = curve(color=color.green, radius = 2) while ball.y > 0.51: rate(50) if scene.mouse.clicked: ball.pos = ball.pos + ball.velocity*dt if ball.y < 0.51: ball.velocity.y = -ball.velocity.y else: ball.velocity.y = ball.velocity.y - g*dt ball.velocity.x = ball.velocity.x + ax*dt ball.velocity.z = ball.velocity.z + az*dt #########This is how you add to a curve###################################### ball.trajectory.append(pos=ball.pos) #print ball.velocity.y