这很简单,但我无法得到它。
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时改变方向。我不确定我做错了什么