Browse Source

smooth rotation

sl@cccfr.de 2 years ago
parent
commit
bad9754765
1 changed files with 3 additions and 2 deletions
  1. 3 2
      Player.gd

+ 3 - 2
Player.gd

@@ -69,6 +69,7 @@ func _physics_process(delta):
 	up = global_transform.origin.normalized()
 	right = forward.cross(up).normalized()
 	forward = up.cross(right).normalized()
+	transform.basis = Basis(right, up, -forward)
 	
 	if can_move and (is_on_floor() or allow_fall_input):
 		
@@ -108,10 +109,10 @@ func _physics_process(delta):
 
 	velocity = velocity.linear_interpolate(dir * (move_speed_sprint if move_sprint else move_speed), move_acceleration * delta)
 	if !is_on_floor():
-		velocity += -up * gravaty * delta
+		velocity -= up * gravaty
 	velocity = move_and_slide(velocity, up)
 	
-	transform = transform.looking_at(transform.origin + forward, up)
+	
 	
 	
 	#Smooth movement