Godot Version
4.4
Question
Hello I am trying to make a wall run and wall run jumpsuch as the game Rayman legends/ Orgins I think it could be a problem with my gravity formula which looks like this
@export var jump_height : float = 100.0
@export var jump_time_to_peak : float = 0.9
@export var jump_time_to_descent : float = 0.25
@onready var jump_velocity : float = ((2.0 * jump_height) / jump_time_to_peak) * -1.0
@onready var jump_gravity : float = ((-2.5 * jump_height) / (jump_time_to_peak * jump_time_to_peak)) * -1.0
@onready var fall_gravity : float =((-2.5 * jump_height) / (jump_time_to_descent * jump_time_to_descent)) * -1.0
func gravity() -> float:
return jump_gravity if velocity.y < 0.0 else fall_gravity
func handle_jump():
if is_on_floor():
velocity.y = jump_velocity
is_jumping = true
And I am checking if im on a slope and rotating the character with
var offset: float = deg_to_rad(0)
var fall_off_wall = false #makes the characte fall off the wall
var control_lock = false #disables the inputs of left and right
var slope_steep := 0.0 #checks steepness of slopes
var slope_factor := 0.0
var grounded := false #checks if is on ground
var rot := 0.0 #Rotation of sprites and collisions
if is_on_floor():
slope_steep = get_floor_normal().angle() + (PI / 2)
slope_factor = get_floor_normal().x
else:
slope_factor = 0
$OrenCollisions.rotation = rot
$PlayerSprites.rotation = lerp_angle($PlayerSprites.rotation, rot, 0.25)
if is_on_floor(): #Rotates the collisions and the sprites along slopes
up_direction = get_floor_normal()
rot = slope_steep
Sorry if this is a lot i have been stuck on trying to make a wall run that sticks the player to slopes for the longest time