help asap

the_proud_family the_proud_family at yahoo.com
Mon Dec 6 03:17:44 CET 2004


HELP ME PLEASE!! my email is the_proud_family at yahoo.com

I can't get the ball to go up right side and then I need it to turn

around and keep turning until velocity=0 I have been at it for the

past 2 weeks now i give up and call for help. Please if anyone can

gide me through i will be so grateful!! I have pasted my code below





from cmath import *

from visual import *

floor1 = box(length=10, height=0.5, width=4, color=color.blue)

floor1.pos = (-6,4,0)

floor1.axis= (5,-5,0)

floor2 = box(length=10, height=0.5, width=4, color=color.blue)

floor2.pos = (6,4,0)

floor2.axis= (-5,-5,0)

floor3 = box(length=7, height=0.5, width=4, color=color.blue)

floor3.pos = (0,1.25,0)

ball= sphere(radius=0.5, color=color.red)

ball.pos=(-8.6,7.5,0)

m=3. #kg

angle=asin(3.6/5.)#radians

g=-9.8

mu=.2

N=mgcos(angle)

F=mgsin(angle)

f=mu*N

lax=(-Nsin(angle)+fcos(angle))/m

lay=(-Ncos(angle)-fsin(angle)+m*g)/m

rax=(+Nsin(angle)+fcos(angle))/m

ray=(-Ncos(angle)-fsin(angle)+m*g)/m

ds=0.01

dt=0.01

vx=lax*dt

vy=lay*dt

ball.velocity=vector(vx,vy,0)

#print a

while 1:

rate(100)

ball.velocity.x=ball.velocity.x+lax*dt

ball.velocity.y=ball.velocity.y+lay*dt

ball.pos=ball.pos+ball.velocity*dt

if ball.x>-3.5 and ball.x<=3.5:

vx=sqrt(2(-gball.y+0.5(vx2+vy2)-fds))

ball.velocity.x=ball.velocity.x+mugdt

ball.velocity.y=0

ball.pos=ball.pos+ball.velocity*dt

if ball.x>3.5 and ball.x<8.6:

vx=vx*cos(angle)

vy=sqrt(2/m(m-gball.y-fds))

#print vy

vy=vy*sin(angle)

#print vy

ball.velocity.x=ball.velocity.x+rax*dt

ball.velocity.y=ball.velocity.y+ray*dt

ball.pos=ball.pos+ball.velocity*dt

#print ball.pos







More information about the Python-list mailing list