Godot Version
4.2.1
Question
I’m trying to implement physics interpolation into a 2d topdown to fix “frame stuttering / blur” in environment.
this seems to work really well although now the player can move through walls because the position is being modified. I’m not really sure where to go from here
I tried adding if !is_on_wall() but that only fixed it 50% of the time
func _process(delta): # calculate curve direction from velocity.angle instead
var alpha = Engine.get_physics_interpolation_fraction() # interpolate movement
smoothed_position = previous_position.lerp(current_position, alpha)
global_position = smoothed_position # move the player in the idle process
curve_and_jump()
label_settings(delta)
func _physics_process(delta):
previous_position = current_position # update previous position
physics_movement(delta) # handles movement
drift(delta) # handles drift
custom_tile_data_getter() # gets custom tile data
current_position = global_position # update current position
current_position += velocity * delta # add velocity
print(velocity)
move_and_slide()