Hi guys, so im working on a skate game and put a ramp to test on it, the problem is that the player slows down when going up to the point it gets stuck on the ramp, this is how i have it set up:
and this is my player settings
im not sure whats the problem is, i just want the player speed to stay the same when going up and down the ramp.
Iam using Godot 4.4, and here is what i tried:
-
i already tried playing with physical material
-
i tried playing with gravity and even completely removed it from my script, but still same result
-
played with some gravity settings but im not sure what they all do so maybe i missed something
Here is my movement code
func _physics_process(delta):
if not is_on_floor():
velocity.y -= gravity * delta
# Handle jump
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = JUMP_VELOCITY
# Get input and camera target
var input_dir = Input.get_vector("right", "left", "backward", "forward")
if camera_target:
camera_T = camera_target.global_transform.basis.get_euler().y
else:
return
if not lock_movement:
# Rotate player to face camera direction
var target_direction = (Vector3(input_dir.x, 0, input_dir.y)).rotated(Vector3.UP, camera_T).normalized()
if target_direction != Vector3.ZERO:
var target_angle = atan2(target_direction.x, target_direction.z)
rotation.y = lerp_angle(rotation.y, target_angle, turn_speed * delta)
# Handle movement - ONLY in character's forward direction
if input_dir != Vector2.ZERO:
# Move in character's current facing direction
var forward_dir = transform.basis.z
velocity.x = forward_dir.x * player_speed
velocity.z = forward_dir.z * player_speed
else:
# Decelerate when no input
velocity.x = move_toward(velocity.x, 0, 8 * delta)
velocity.z = move_toward(velocity.z, 0, 8 * delta)
move_and_slide()