How to create a magnet simulation like Magnet Simulator?

Hi there, let’s get straight to the point, I’ve been struggling to find a good method to create a magnet effect, a good presentation of what I would like is displayed on Magnet Simulator.

What solutions have I tried? Well I tried LineForce, AllignPosition, also BodyPosition, and last but not least TweenService, I find TweenService to be the closest to my solution because it doesn’t actually apply to real-world physics and the part doesn’t need to be unanchored, as I am not really asking for anything physics base, now I did try using those 3 above with simply unanchoring the part which I want to be pulled into my character but, I must mention the part in which I’m pulling in has no collision, so for right now TweenService is my get go, but I know there’s another way of doing this while also keeping it a smooth constant position to my character. There’s no point in showing what my current system looks like because I plan on changing it based on what Magnet Simulator seems to use, and by the looks of it, it looks nothing like TweenService to me. So in conclusion, if someone could explain what Magnet Simulator is using, I don’t need no code provided at all, I just want to know what they use to accomplish it.

Video of what I’m looking for:

1 Like

I don’t know what Magnet Simulator is, but that clip looks like they’re just unanchoring things and putting a BodyPosition in them.

What do you need this for?

If it’s just a visual affect you could just move all the affected parts some percentage of the way towards to goal every frame. I use that trick for simple visuals sometimes.

Also maybe “magnet” isn’t the best word for this. It looks like parts fly towards some target faster the further away they are, which is the opposite of how magnets work :slight_smile:

1 Like

Alright! I’ll give it a try, I’ll let you know if it works, and yes I know I shouldn’t be calling a “magnet” I just didn’t know what else to call it lol, but thank you for the suggestion! Will mark as solved if it seems to work for me, thank you for your reply!

1 Like

Hey so it seems to work just as I want it to but, I’m having trouble setting the properties in which they go about the same speed in the clip, these are the current properties values I have set on the BodyPosition

image

Video:

1 Like

Alright, after redirecting my thought process, I decided to use AlignPosition CORRECTLY (Had it anchored last time lol), and it works just how I want it to! In fact it works even better! Anyone looking to create a “magnet” like physics use AlignPosition! It works just great!

4 Likes