I'm trying to find how to move node continuously

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By RROP

I’m trying to make 3d rhythm game and I have problem for it

the code below is pretty works well but
I’m trying to find how to make this node keep moving

because I want to add some bpm shift, and stop

to make those function, I think i need to move node with just direction, and moving distance per second

I tried to make tween’s complete signal to start again that current position, but it has a delay and it caused sync problem

If you have any good functions or algorithm please help me

extends Spatial

var global
var length:float
var ready_time:float

func _ready():
	global=$"/root/Global"
	length=float(global.song_inf_bpm*global.std_length_by_beat*global.song_inf_length)/float(global.song_std_bpm)*global.note_length
	ready_time=float(global.song_inf_bpm*global.std_length_by_beat*3)/float(global.song_std_bpm)*global.note_length
	var tw=get_node("Tween")
	tw.interpolate_property(self , "translation",Vector3(0,0,-ready_time),Vector3(0,0,length),global.song_inf_length+3)
	tw.start()
:bust_in_silhouette: Reply From: timothybrentwood

If you’re attempting to make a rhythm game like guitar hero or DDR, you dpn’t want to tween the movement of the ‘notes’ - think that would make it very difficult to accurately determine whether the ‘note’ was hit at the correct time. The approach I would take would be to move the ‘note’ in the _process() or _physics_process() function.

var direction
var start_position
var end_position
var bpm_speed

func _ready():
    start_position = #something
    end_position = #something
    direction = end_position - start_position
    bpm_speed = #something

func _process(delta):
    translation = translation + (direction * bpm_speed * delta)
    if translation.distance_squared_to(end_position) < 0.1: # we hit our end position
        set_process(false) #stop it from moving and do your cleanup

I’ve already programmed the notes to calculate their own judge time.
So, Your answer seems to be the answer I was looking for.
I don’t know if it will move as smoothly as the Tween, But I’m going to try it right now
Wait, isn’t it just implementing tween with translation…?

RROP | 2022-11-10 02:50