I'm doing this 2D (top-down perspective :D).
Basically the 'main' scene is a
StaticBody with a script which allows me to rotate it and the following children:
- an instance of another scene (the moving character).
The code for the child scene is the following, currently attached to an
Area2D node (since the
move function stops the sprite while I'm rotating its parent):
var speed = 50.0
onready var start_pos = get_viewport().get_rect().size / 2
var movement = Vector2()
var direction = Vector2()
var cur_pos = get_global_pos()
direction = start_pos - cur_pos
movement += direction.normalized() * speed * delta
What happens is that the child node rotates around its pivot (not around the parent's) and just keeps going to the center.
What I want is to change the child's position according to the rotation (just imagine you put a rubber on a rotating DVD :p), while it's still moving towards the center of the screen.
Am I overthinking this? Should I change approach?