View Single Post
  #3  
Old 06-15-2018, 08:38 PM
hannahapz hannahapz is offline
Member
 
Join Date: Apr 2018
Posts: 14
Solved

I solved the issue with a simple if-elif statement

Code:
def pedestrian_actions(): 
	ped_position = pedestrian.getPosition()
	car_position = car.getPosition()
	distance = vizmat.Distance(ped_position, car_position)
	runAction = vizact.walkTo( [-12, 0, 3] )
	print(distance)
	
	if distance > 4:
		pedestrian.addAction (runAction) 
	elif distance < 2:
		pedestrian.clearActions()
Reply With Quote