Object keeps appearing in the scenes middle

I’ve made a saw obstacle for a 3D platform game I’m developing, but every time I start the debug, it will be in the middle of the scene, not where i put it on the editor.
Here’s the code for my saw

extends Node3D


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	$AnimationPlayer.play("move") #movement animation
	$AnimationPlayer.play("spin") #rotation animation


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	if $Saw.playing == false:
		$Saw.play()


func _on_area_3d_body_entered(body: Node3D) -> void:
	if body.get_name() == "Player":
		get_tree().change_scene_to_file("res://Others/lost.tscn")

This happens because the Animation player’s position track is not RELATIVE to where you placed it in the scene. So as an example, if you made your object’s X in the animation player go from 0 to 50, as soon as the game starts, the animation player will place your object at the 0 X position, then move it to X 50 and etc…

I recommend using a Tween instead of an animation player for moving objects like this one, and using 3D markers to mark the two points it should move between.

1 Like

I’ve disabled the move animation and it still spawns in the middle of the scene on debug

How did you disable the animation? Since if the AnimationPlayer is still present in the scene, it’ll still bring the object to the starting point (Because of the RESET track).

I deleted the animation player and it still keeps appearing in the middle of the scene
I also made a test object with no animation node and it’s still created in the middle of the scene

Then it sounds like another piece of code is modifying the positions of your objects.