I do not know if there was an update or something similar these past few days, but for some reason, a program I was writing for a school program is no longer functioning. I have not been the only one having this problem. Several of my classmates encountered similar issues. Having changed nothing since yesterday, upon opening and running my program today the simulation no longer runs. Since the program itself runs, but not as it should and did a few days ago I have no idea as to how to resolve this issue or if there is a solution. What several classmates and I have determined to be the issue is that in the while loop, when declaring a component of a variable to be a new value with each run the program no longer does this. So when before something like, thisobject.pos.x=thisobject.pos.x+2dt, would create motion it no longer does. Here is the code I have at the moment as it was when it was last working, yesterday, Monday the 22nd. If anyone knows why this no longer works or how to fix it, please give your input.
GlowScript 2.4 VPython
#Use these Variables to Run the program.
#suggested values of 0<x<90
angled=45
#suggested values of 1<x<20
mass=80
#suggested values of 20<x
velocity=20
#Values must fall between 0<x<1
elasticity=.4
#FrictionForce
forcef=0
#Do not Change anything below this point
alert('READ THIS. To launch a second orb, please restart the program. To launch press spacebar. For best results launch immediately. You have only around 15 seconds for your launch to proceed. Doubleclick SPACE to begin.')
scene.camera.pos=vec(0,0,0)
scene.camera.axis=vec(-.25,-.75,-1)
scene.width=1000
scene.height=500
scene.range=65
scene.autoscale=False
accelg=-9.8
angleb=angled*(pi/180)
vx=velocity*cos(angleb)
vy=velocity*sin(angleb)
cannonlengthx=5*cos(angleb)
cannonlengthy=5*sin(angleb)
t=0
def keyboard(event):
if event.type='keydown':
k=event.which
#print(k)
if k==32:
bullet=sphere(pos=vec(-100+cannonlengthx,2+cannonlengthy,0), radius=0.9, color=color.white, make_trail=True,trail_type="points",
interval=30, retain=80,texture="https://st.depositphotos.com/3113551/4586/v/950/depositphotos_45865131-stock-illustration-golf-ball-texture.jpg")
bullet.v=vec(vx,vy,0)
bulletsList.append(bullet)
t=0
scene.bind('keydown', keyboard)
bulletsList=[]
scene.title = "Cannon Launch and Elasticity \n"
bore= cylinder(pos=vec(-100,2,1), axis=vec(5,0,0), radius=1, texture=textures.rough)
platform=box(pos=vec(0,0,0), size=vec(200,1,20), color=color.orange, texture=textures.wood_old)
platformgreen=box(pos=vec(0,0.1,0), size=vec(190,1,10), color=color.green, texture=textures.rough)
goal=cylinder(pos=vec(90,0,0), axis=vec(0,1,0))
goal=cylinder(pos=vec(90,0,0), axis=vec(0,1,0))
flag=cylinder(pos=vec(90,3,0), axis=vec(0,15,0), radius=0.5)
a = vertex( pos=vec(90,18,0) , color=color.red)
b = vertex( pos=vec(90,14,0) , color=color.red)
c = vertex( pos=vec(85,16,0) , color=color.red)
T = triangle( vs=[a,b,c] )
wheel= sphere(pos=vec(-100,2,1), radius=1.5, color=color.white, texture=textures.rough)
bore.rotate(angle=angleb,axis=vec(0,0,1),origin=wheel.pos, color=color.white)
dt=.01
ft=0
dft=0.01
velocityx=series(color=color.cyan, label='velocity vs. time')
#kineticenergy=series(color=color.green, label="kinetic energy vs. time")
while 1:
rate(200)
at=0
ddt=1
at=at+ddt
for thisbullet in bulletsList:
ke=.5*mass*thisbullet.v.y**2
if thisbullet.pos.x<90:
thisbullet.pos.x=thisbullet.pos.x+thisbullet.v.x*dt
thisbullet.v.y=thisbullet.v.y+accelg*dt
thisbullet.pos.y=thisbullet.pos.y+thisbullet.v.y*dt+(1/2)*accelg*dt**2
if thisbullet.pos.x > 90:
thisbullet.v=vec(0,0,0)
accelg=0
break
del thisbullet
thisbullet.visible=False
elif thisbullet.pos.y>2.01:
ft=0
elif thisbullet.pos.y<2.01:
thisbullet.v.y=-1*thisbullet.v.y
thisbullet.v.y=(sqrt((2*(elasticity*ke))/mass))
thisbullet.v.x=thisbullet.v.x-(forcef*ft/mass)
ft=ft+dft
elif thisbullet.pos.y<2.1 and thisbullet.pos.x>60:
thisbullet.pos.y=2
accelg=0
while thisbullet.v.x<0:
thisbullet.v=vec(0,0,0)
accelg=0
#thisbullet.visible=False
#kineticenergy.plot(t,ke)
if t<10:
velocityx.plot(t,thisbullet.v.x)
if at==1+ddt:
print('Horizontal Velocity:',thisbullet.v.x)
t=t+dt
#elif thisbullet.pos.x >90:
#break