0 votes

I need a rigidbody2d with a sphere collision shape to magnetically attach to instances of itself when they get into a certain proximity of each other. Any tips or links to tutorials?

in Engine by (33 points)

3 Answers

+1 vote
Best answer


Some fun stuff I read about today.
One of the many benefits to Area2Ds is their ability to alter physics. One of these alterations is known as point gravity. I can see you using an Area2D node as a child of your RigidBody2D node to achieve the desired effect. More details about this process can be found towards the bottom of this page.

I hope I could be of some assistance to you.

by (155 points)
selected by


I was trying Area2D's gravity point before but I didn't realize I had a bug with the gravity:

I ended up starting a new project and recreating my scenes and it works just fine now.

Thank you.

So glad you got it figured out!

+1 vote

Sounds a bit like the 'planet jumper' tutorial I have been trying to pick apart this last week might be along the lines you are looking for....


by (35 points)

I'm checking it out, thanks.

0 votes

Maybe you could use an Area and when a object enters the Area then use the move_toward() function. Im still pretty new to godot so idk if this would work

so position.move_toward(Vector2(x, y), speed)

by (14 points)

Interesting, I'll try it out, thank you.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.