Set Player rotation
This commit is contained in:
		
							parent
							
								
									c0d25d29ba
								
							
						
					
					
						commit
						823846cfd1
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -20,12 +20,16 @@ func _physics_process(delta):
 | 
			
		|||
	
 | 
			
		||||
	if Input.is_action_pressed("ui_up"):
 | 
			
		||||
		direction += Vector3(0, 0, -1)
 | 
			
		||||
		set_rotation_degrees(Vector3(0, 180, 0))
 | 
			
		||||
	if Input.is_action_pressed("ui_down"):
 | 
			
		||||
		direction += Vector3(0, 0, 1)
 | 
			
		||||
		set_rotation_degrees(Vector3(0, 0, 0))
 | 
			
		||||
	if Input.is_action_pressed("ui_left"):
 | 
			
		||||
		direction += Vector3(-1, 0, 0)
 | 
			
		||||
		set_rotation_degrees(Vector3(0, -90, 0))
 | 
			
		||||
	if Input.is_action_pressed("ui_right"):
 | 
			
		||||
		direction += Vector3(1, 0, 0)
 | 
			
		||||
		set_rotation_degrees(Vector3(0, 90, 0))
 | 
			
		||||
		
 | 
			
		||||
	direction.y = 0
 | 
			
		||||
	direction = direction.normalized()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue