Last active
June 20, 2017 13:53
-
-
Save FEDE0D/ee24480de4d8fd31efa0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You can do this | |
func _fixed_process(delta): | |
var pos_a = get_node("body_a").get_global_pos() | |
var pos_b = get_node("body_b").get_global_pos() | |
# lets say you want to move the body_a to body_b | |
var new_pos = pos_a.linear_interpolate(pos_b, delta) | |
get_node("body_a").set_global_pos(new_pos) | |
# linear_interpolate receives the final position and a value between 0 and 1. | |
# If its 0 :> returns the starting pos | |
# If its 1 :> returns the final pos |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment