BruceSherwood/vpython-wx

make_trail failing for ball.pos = vector(t,0,0)

Closed this issue · 2 comments

from visual import *
ball = sphere(pos=(0,0,0), radius = 5, make_trail = True)
ball.trail_object.radius = 3 # no problem if 0
t = 0
while t <= 100:
rate(50)
ball.pos = vector(t,0,0) # no trail unless trail_type="points"
t += 1

No problem if the update is this: ball.pos = ball.pos + vector(1,0,0)

The problem is with the thick version of the curve object:

y = 1 # if y is 0 and radius is nonzero, nothing is displayed
c = curve(pos=[(0,y,0)], radius=0.2)
c.append(pos=(0,y,0))
c.append(pos=(1,y,0))

There is also a trail problem: ball.pos.x = t or ball.pos.x += 1 does not trigger adding to trail.

Fixed both trail problems by not duplicating curve points and by detecting changes in ball.pos.x. There remains a bug in the curve object which I'll post separately.