Moving Platforms Juttering or stutturing

I’m new to game development. I started using Godot one month ago, maybe more, and I’m having a problem with the moving platforms I created. I’m using AnimatableBody2D. At first, I was using an AnimationPlayer, but then I removed it and started using a script to handle the animation instead. The actual problem is that when my character (I’m using CharacterBody2D) stands on the platform, the platform appears to jitter or stutter. However, when I’m not on the platform, it moves smoothly. I can’t understand what might be causing this issue. Does anyone have any suggestions?

This is my current code for my platform, I know I can use directly tween for animation, but I’m trying different options and trying to fix this.

extends AnimatableBody2D

@export var move_offset: Vector2 = Vector2(0, 0)
@export var duration: float = 2.0

@export var ease_type: Tween.EaseType = Tween.EASE_IN_OUT
@export var trans_type: Tween.TransitionType = Tween.TRANS_SINE

var start_position: Vector2
var target_position: Vector2
var time_passed: float = 0.0
var forward: bool = true

func _ready():
	start_position = global_position
	target_position = start_position + move_offset

func _physics_process(delta):
	time_passed += delta
	var t = time_passed / duration

	if t >= 1.0:
		t = 0.0
		time_passed = 0.0
		forward = !forward

	# Apply transition + ease manually
	t = Tween.interpolate_value(
		0.0,        # initial value
		1.0,        # delta
		t,          # elapsed
		1.0,        # duration
		trans_type,
		ease_type
	)

	var from_pos = start_position if forward else target_position
	var to_pos = target_position if forward else start_position

	global_position = from_pos.lerp(to_pos, t)

If I was you I would have used staticbody2d and a animation player but I haven’t used it yet in my game.

Maybe this would work.

Didn’t help, I tried with StaticBody2D for the platform not working eather, even I moved the camera to not be child of the player but without result

Can you provide a video showing the issue happening?

Yes, These are the videos, it could be my the camera or player collision, I can’t understand why this is happening

I found the solution, I had to turn off the Snap 2D Transforms to Pixel and that fix it

1 Like