Is it possible to stay on specific frames by selecting them in the code?

Godot Version

Godot 4.6

Question

Im trying to get 360 degree free aiming working in my game like in the newer metroid games (samus returns and dread). Below is my aiming code which works fine for aiming:

	if aiming:
		if raw_input and controller:
			if snapped(_skin.rotation.y, 0.1) == snapped(PI/2, 0.1):
				_spawn_pivot.rotation.x = lerp_angle(_spawn_pivot.rotation.x, atan2(raw_input.y, raw_input.x), 0.5)
			elif snapped(_skin.rotation.y, 0.1) == snapped(-PI/2, 0.1):
				_spawn_pivot.rotation.x = lerp_angle(_spawn_pivot.rotation.x, atan2(raw_input.y, raw_input.x * -1), 0.5)
		if not controller:
			var _basis = get_viewport().size/2
			var pos = Vector3(-get_viewport().get_mouse_position().x + (_basis.x * 1.01), get_viewport().get_mouse_position().y - (_basis.y * 1.27), position.z)
			_spawn_pivot.look_at(pos)

But I need to get the model to aim in the correct direction. My approach was to create 360 different frames for the player aiming at each direction and I was hoping there was a way to cycle between the frames in the code. The rotation of “_spawn_pivot” is the angle the player is aiming at and when converted to degrees, is the frame the player should be on. Is this possible?

below are the frames Im trying to cycle between

You can set the current animation time from code using AnimationPlayer::seek()

what did I do wrong here? It didnt work for me

if aiming:
		_skin.animation_player.seek(snapped(rad_to_deg(_spawn_pivot.rotation.x), 1))

“_skin” is the player model.

“Didn’t work” In what way? What happened vs what were you expecting to happen.

Sorry, I meant it didnt do anything but I realized I wasnt calling the animation I wanted.

Changed it to:

if aiming:
	_skin.animation_player.current_animation = "Aim_Angles"
	_skin.animation_player.seek(snapped(rad_to_deg(_spawn_pivot.rotation.x), 0.1))

Its now calling the animation but Its off. I think its calling it as time instead of the specific frame so Im gonna see if I can fix that

Yes, Godot’s timeline unit is seconds, not frames. You need to divide the frame number by animation’s fps.

Thank u so much, it works perfectly!!! i was so worried abt getting this working