Godot Version
4.4
Question
Hi all, I am trying to move my player by tweening from point to point. I have door areas where I want the player to snap(teleport) from one side of the door to the other instantly. This should be simple, I just do “self.position = location”
except nothing happens. No matter what I try, the player does not move. What is weird is that if i click again to move, that is when the player does instantly snap to the location. Its not a time based thing, but for some reason even though I tell the player to move, it refuses to move until I move again, then it instantly snaps.
What is going on?
CODE:
func tween_to_node(pos: Vector3):
var offset_position = Vector3(pos.x, 0, pos.z)
var height = GAMEMANAGER.core.terrain.data.get_height(offset_position)
target_position = Vector3(offset_position.x, height, offset_position.z)
tween = get_tree().create_tween().bind_node(self).set_trans(Tween.TRANS_LINEAR)
tween.tween_property(self, "position", target_position, 1.2)
That is the code to do the tween movement. Super simple, works fine. Here’s the code that gets called (by the door) to “relocate” the player:
func relocate_to_node(pos: Vector2i):
var offset_position = Vector3(pos.x, 0, pos.y)
var height = 4
var relocate_position = Vector3(pos.x, height, pos.y)
So what is the problem?