Isolate objects from local gravity (like magnet)

About advanced scenes, and the Thyme scripting language used in Algodoo.

Isolate objects from local gravity (like magnet)

Postby Paulelie » Sat Jan 11, 2014 8:14 pm

Hello everybody,
I have a scene with standart general gravity and local gravity on few objects (like magnets)
I want to know if is it possible to force some objects to use only general gravity? :wtf:
Thanks for your replies
Paulelie
 
Posts: 3
Joined: Sat Jan 11, 2014 7:29 pm

Re: Isolate objects from local gravity (like magnet)

Postby electronicboy » Sat Jan 11, 2014 11:04 pm

are you using magnets to create the "local gravity"?
If not, I have no idea what you're asking, however I rarely do open algodoo much these days (too busy working)
if you are, you can do what you're asking using collision layers, as magnets only create forces on objects in the same collision layer!

You could, for example:
<A> -general
<B> - magnet

All layers will be affected by gravity, there is no way to make gravity work on select collision layers, however magnets allow that.
As in the above collision layer examples, if you had 2 objects:
1(A)
2(AB)

object 2 would be attracted by magnets, as it's on collision layer B, which you would also have on your magnet.
Because object one and two have collision layers A, they will both collide with one another.
When asking for help, READ THE STICKIES!
electronicboy
 
Posts: 1694
Joined: Mon Aug 31, 2009 6:18 pm

Re: Isolate objects from local gravity (like magnet)

Postby Paulelie » Sun Jan 12, 2014 1:10 am

Thank for your reply electronicboy.

Yes I use "local gravity" for magnets. But it is gravity, not magnetism and all objects are attracted, steel, glass, stone.
I want to apply magnets "local gravity" on another magnets attached to a wheel, but this wheel must be attracted only by general gravity (earth 9.8). Currently magnets attract also the wheel...
Whit layers, you think this is possible?
Paulelie
 
Posts: 3
Joined: Sat Jan 11, 2014 7:29 pm

Re: Isolate objects from local gravity (like magnet)

Postby Paulelie » Sun Jan 12, 2014 1:46 am

I try layers, and it is same.
Need a script for each objects where I want remove gravity from magnets.
Paulelie
 
Posts: 3
Joined: Sat Jan 11, 2014 7:29 pm

Re: Isolate objects from local gravity (like magnet)

Postby Xray » Sat Jan 18, 2014 9:32 am

Hi Paulelie - Algodoo, to my knowledge, does not have a magnetic force that only attracts or repels steel objects. Therefore, it does not have "magnets". But you can simulate a magnet by using some clever tricks. For example, if you can use a "magnet" that will only attract steel in the X direction, then you can nullify the force of gravity on particular objects in the Y direction. You do that by enabling some other collide layer besides the layer that objects attracted by gravity will use. So, for example, we will use collide layer "B" (2 in the script menu). Make a box, and give it the "steel" material, and enable collide layer B. Then set the "attraction" to some number higher than zero. (Try 10.0 at first). Now you have a magnet!

Now create steel objects that will attract to your magnet by enabling their collide layer B. Now, note in the script menu of each steel object the "valocityDamping" property. It has three values: {X damping, Y damping, Rotation damping]. Set the Y damping to 1.0, which will dramatically resist movement in the Y direction. So, the value box should look like this: [0.0,1.0,0.0]. That should do it! Now bring the steel object near either side of the "magnet" and start Algodoo. The steel object should quickly move to and collide with, and stick to the magnet. It will slightly move in the Y direction, but it won't be much. I forgot to mention you should glue the magnet to the background so that it does not move. Only the steel objects should be allowed to move for this demo.

Experiment with this technique and let me know if this will work for what you need. If not, we can try other things. :)
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Isolate objects from local gravity (like magnet)

Postby s_noonan » Sun Feb 02, 2014 12:37 am

If wheel attracts magnets then magnets attract wheel. There is no way around it. I think it's one of Newton's laws.
s_noonan
 
Posts: 61
Joined: Tue Mar 30, 2010 2:25 am

Re: Isolate objects from local gravity (like magnet)

Postby Jimmyfisherman » Fri Oct 17, 2014 10:41 pm

I think this is what he wanted: Magnets attract metal, but nothing else is affected. If it is true that objects are affected by attraction on only their collide layers, then it would be as simple as assigning steel objects to A and B and the magnet is only on B. Everything else would be on only A so its not affected by the magnet.
Jimmyfisherman
 
Posts: 18
Joined: Thu Oct 02, 2014 9:20 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 6 guests