Home    LittleBigPlanet 2 - 3 - Vita - Karting    LittleBigPlanet 2    [LBP2] Help!
#1

Modelise magnets behaviour

Archive: 8 posts


Hello,

I'm currently working on a level with magnets, and I'm trying to have a magnet that behave like a magnet (and more, but I'm just trying to have a basic behaviour working here ).

I have added in attachments an ugly paint that show what I've done, even with this picture it will be difficult to explain what I've done with my poor english.
http://www.lbpcentral.com/forums/attachment.php?attachmentid=33045&d=1302531050
The magnet have to sides (+ and -, or red and blue). Blue is the exact same as red, but with inverted colors tag.

On the red side, there is a "Red Tag", a "Red sensor" and a "Blue sensor". The analog signal from both of this sensor is send to a follower. The red one is set to avoid, the blue one is set to follow. the radiuses of the sensor and follower is set to be as big as possible without reaching the blue microchip on the other side of the manget, and followers are set to the "strength" option.

In the center of the magnet, a chip select the strongest of the 4 signals (2 from the red side, 2 from the blue side), and activate the corresponding microchip. I have used a selector to select the strongest of the analog signal, it seems to work but i'm not sure if it's the good solution...

It's kind of working with 2 magnets, but when I use 3 magnets it doesnt work very well. This is mostly cause by the way that the magnet select only one signal, so if there is something like this : (+-)(+-)(-+), the last (-+) will not be redjected because the active follower on the central magnet is the - follower on the left. I'm not sure if I'm really clear here...

Do you have an idea about this ? Or do you have better idea to modelise magnets behaviour ? (I can share a level with what I've currently done if you want to try things)

Thanks a lot for your help ! I know this is a difficult and vast question, so I don't really expect anwers, but if you have clues or ideas to help me with this, you're welcome.

PS : I know that poms release a level about Magnetic stuff a few days ago, but I've already started working on this one, and after playing poms' level (you should do it if you havn't yet, it's very good), I saw that it wasn't exaclty the same type of puzzles. So I've decided to work on it and publish it even if there is already a brillant level on the magnetic theme...
2011-04-11 15:45:00

Author:
Slurm
Posts: 262


How about just having corresponding tags on either ends of the magnets (blue and red) then a few followers in the middle on a microchip. You'll need four followers each with a 180 degree radius with settings of one to follow the red tag, one to follow the blue tag, one to flee the red tag and one to flee the blue tag. You'll want the red flee and blue follow movers' radius to cover the entire red side of the magnet and the blue flee and red follow movers to cover the blue side. This should work as a basic magnet and wil still work when more than two are present. You can fiddle around with how strong they attract and repel each other by altering the speed, acceration and activation radius of the movers.2011-04-11 16:35:00

Author:
Xaif
Posts: 365


I can move the followers in the middle of the magnet, but I think this won't solve the issue with more than 2 magnets.
Mabye I'm wrong, but it seems to me that only one follower can be used at the same time on an object. If two followers are active, the object will not move.

I'll have to re-check this, but anyways thanks for your anwser.
2011-04-11 16:52:00

Author:
Slurm
Posts: 262


I can move the followers in the middle of the magnet, but I think this won't solve the issue with more than 2 magnets.

It won't actually make any odds. All movers (including followers) apply their forces from the attached object's center of mass, regardless of where they are on the object, so when you have multiple movers, it's quite easy for these forces to cancel each other out.

IIRC, objects connected using connectors count as separate objects for this purpose, so you may have more luck if you bolt something else to either end, and attach the followers to those, although you'll have to deal with relative weight ratios - the force will be stronger if the bolted objects have a greater mass that the main body.
2011-04-12 19:03:00

Author:
Aya042
Posts: 2870


I can move the followers in the middle of the magnet, but I think this won't solve the issue with more than 2 magnets.
Mabye I'm wrong, but it seems to me that only one follower can be used at the same time on an object. If two followers are active, the object will not move.

I'll have to re-check this, but anyways thanks for your anwser.

You're correct. In fact I think the follower with the highest strength setting will dominate.

Anyway if you want true magnet motion (I'm not sure what your exact aim of this is, perhaps if you explained the context someone might be able to come up with a workaround) you'll have to basically calculate:
Sum(i=1..n){(x-mi)/|x-mi|3}
And then integrate this (2-dimensional vector) over time to give the velocity which you plug into an advanced mover as "speed scale".
Now this calculation can be done (I think), you will have to use a multiplication chip (I have made one) as well as some clever methods of extracting vertical and horizontal distance information, and finally a couple of timers to use for integration.

But... for most purposes in a level (other than a physical simulation and a pretty visualisation of the 3-body problem) you'll probably be best to only apply forces from the closest body, for which you can use a follower and not worry about having the correct acceleration.
2011-04-12 20:29:00

Author:
thor
Posts: 388


I've already created a logic-based magnet, and it doesn't use any followers. It uses an advanced mover & advanced rotator & it works with multiple copies of itself. The only problem with my magnet is that its "magnetic field" isn't very large, but still works, & its strength is equal throughout the field. However, the adv. mover & rotator can easily be modified to increase the "realism" of the magnet. I've also made a chain of magnets simply by laying them all down next to each other & lift them up in create mode, so I guess they work well. I've also put the magnet into one of my levels as a bonus prize, "Hover-Tech Tutorial", lbp.me code: "yhks66" or just click the little planet under my name.
<-------------------------------
2011-04-13 01:44:00

Author:
Shuriken_Star
Posts: 114


some clever methods of extracting vertical and horizontal distance information

You can do it by modifying this (http://i8.lbp.me/img/fh/ba8151c46348672869d27497215d4d696415d7b7.jpg) by moving those tag sensors closer to the center and multiplying results by 1000 (2*5=10 10*10*10=1000).
2011-04-13 05:32:00

Author:
waD_Delma
Posts: 282


All movers (including followers) apply their forces from the attached object's center of mass, regardless of where they are on the object, so when you have multiple movers, it's quite easy for these forces to cancel each other out.
Thanks for theses precise technical stuff about center of mass, how forces apply, etc.. I was not sure about how it worked, it will help a lot, and not only for the magnet issue !


But... for most purposes in a level (other than a physical simulation and a pretty visualisation of the 3-body problem) you'll probably be best to only apply forces from the closest body, for which you can use a follower and not worry about having the correct acceleration.

Yes, I do not want a physical simulation, I just want somthing that looks like a magnet. In most of the case, there will only by 2 or 3 magnets involved. About the purpose of magnets in the level, there will be some platforming sequences with magnets involved, and you will quickly learn to activate/deactivate magnet, and switch their polarity, and there will be some easy puzzles/platforming sequences based on theses abilities.


I've also put the magnet into one of my levels as a bonus prize, "Hover-Tech Tutorial", lbp.me code: "yhks66"
I'll check this and if I end up using it (or a tweaked version of it) in my level, I'll sure credit you in the level description ! Thanks !


You can do it by modifying this (http://i8.lbp.me/img/fh/ba8151c46348672869d27497215d4d696415d7b7.jpg) by moving those tag sensors closer to the center and multiplying results by 1000 (2*5=10 10*10*10=1000).
Thanks! I'm not sure if I will use it but seeing how others do their logic things is always helpful.

Again, thanks everyone ! I've already started to create some plaforming & puzzle sequences based on my draft magnet, and it's working as there is only 2 involved here. But I'm still trying to have a beter behaviour, so i'll sure look at all your suggestions
2011-04-13 10:18:00

Author:
Slurm
Posts: 262


LBPCentral Archive Statistics
Posts: 1077139    Threads: 69970    Members: 9661    Archive-Date: 2019-01-19

Datenschutz
Aus dem Archiv wurden alle persönlichen Daten wie Name, Anschrift, Email etc. - aber auch sämtliche Inhalte wie z.B. persönliche Nachrichten - entfernt.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.