![]()  | 
	
| 
		 
			 
			#1  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
			
			 
				
				stop physic
			 
			
			
			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  | 
| 
		 
			 
			#2  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
		
		 
			
			You could use a timer and get the position of the ball.  Once its position has reached the point you specify you can either disable physics for the scene 
		
		
		
		
		
		
		
		
	
	Code: 
	viz.phys.disable() Code: 
	ball.disable(viz.PHYSICS)  | 
| 
		 
			 
			#3  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
		
		 
			
			Can you please tell me how should I use the timer to get the ball position? 
		
		
		
		
		
		
		
		
	
	Thanks alot  | 
| 
		 
			 
			#4  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
		
		 
			
			When the z coordinate of the ball is greater than 10 it will stop 
		
		
		
		
		
		
		
		
	
	Code: 
	def stopball(): pos = ball.getPosition() if pos[2] > 10: ball.disable(viz.PHYSICS) vizact.ontimer(0,stopball)  | 
| 
		 
			 
			#5  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
		
		 
			
			Thanks alot for your help 
		
		
		
		
		
		
		
		
	
	 
		 | 
![]()  | 
	
	
		
  | 
	
		
  | 
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Stop for... loop | Johannes | Vizard | 20 | 04-01-2014 02:53 AM | 
| How to stop vizact.move | Jerry | Vizard | 3 | 06-04-2009 05:25 PM | 
| moving and object by mouse but don't know how to stop the movement | nlfrnassimi | Vizard | 8 | 04-26-2009 08:23 AM | 
| how can I stop an action? | nlfrnassimi | Vizard | 4 | 02-13-2009 01:59 AM | 
| When a video stop ? | djdesmangles | Vizard | 2 | 01-11-2007 05:15 PM |