添加代码行以使球在x = + 9和x = - 9处反向

时间:2017-10-23 22:31:40

标签: python-2.7

这很简单,但我无法得到它。

from visual import *

ball = sphere (pos=(-4, 0, 0 ), radius=0.6, color=color.red)
ball.velocity = vector (15, 0, 0)
deltat = 0.005
t = 0
scene.autoscale = 0
while t < 4 :
 rate (100)
 ball.pos = ball.pos + ball.velocity*deltat
 t = t + deltat

从这里我应该添加线来使球在x = 9和x = -9时改变方向。我不确定我做错了什么

0 个答案:

没有答案