Hi, I’m trying to implement an “attraction” function in my game - press a button, and you’re moved toward a position - press it again whilst being “attracted” and you’ll drop down, normal physics come back. If you hit anything, you stop.
I’m trying to get this to work but it seems positions are offset…
Here’s some diagrams I mockedup
be careful with child transforms! remember that while your parent node has a position, each child also has a relative position to their parent. so for example, your player node (the one with the script) has a collision polygon child that’s offset (moved way down from the center of) the parent!
make sure to check the transform on all of your children. i’d recommend having your collider centered inside of the parent node
since your script is using the global_position of the parent nodes, it’s expecting your player and magnet to be way up at the origins, which is why your motion script is offset