nlfrnassimi
03-10-2009, 01:39 AM
Hi,
I have created a simple bouncing ball. I want it to stop when it reaches a particular point. But I don't know how. I'll appreciate any help.
Here is my code for ball:
import viz
viz.go()
viz.phys.enable()
ground = viz.add('tut_ground.wrl') # Add ground
ground.collidePlane() # Make collideable plane
ball = viz.add('ball.wrl',pos=[0,.2,6]) # Add a ball
ballPhys = ball.collideSphere(bounce = 2) # Enable physics on ball
ball.applyForce([0,.3,.2],0.5) # Apply small force for half a second
I have created a simple bouncing ball. I want it to stop when it reaches a particular point. But I don't know how. I'll appreciate any help.
Here is my code for ball:
import viz
viz.go()
viz.phys.enable()
ground = viz.add('tut_ground.wrl') # Add ground
ground.collidePlane() # Make collideable plane
ball = viz.add('ball.wrl',pos=[0,.2,6]) # Add a ball
ballPhys = ball.collideSphere(bounce = 2) # Enable physics on ball
ball.applyForce([0,.3,.2],0.5) # Apply small force for half a second