Expressions/Scripts/Presets

Moderators: Disciple, zlovatt

 
Magua
Topic Author
Posts: 8
Joined: Sat Feb 21, 2009 11:08 pm

Weighted Directional Random Movement

Mon Feb 03, 2014 4:30 pm

I have a comp setup where I'm running some sims in Newton. Basically, it's a large ring as an outer boundary/boarder and then some smaller shapes on the inside. Those shapes on the inside have a large random drift applied to them
wiggle(.2,200)
. Currently, shapes that have starting positions near the edge of the ring are able to drift outside the bounds of that ring; in Newton, this results in them pushing up against it (as they are denied movement into those coordinates by the wall of the ring). It's an expected result, but it also can result in them continually pushing against it for the whole time of the sim, which is undesirable.

I'm wanting to find a way to weight the movement of those outer shapes, so that it's less and less likely that they'll continue movement in the outer bounds of the ring as they move those directions, and instead, be "coaxed" to randomly drift more towards the center of the ring.... make sense?

I've attached some pictures to try and illustrate the setup, current issue, and hopeful resolution (which seem to be appearing in reverse order). Thanks so much in advance, as this is a little outside of my abilities...

Cheers
Attachments
Screen shot 2014-02-03 at 3.04.20 PM copy2.png
And finally, here's what I'm trying to achieve.
Screen shot 2014-02-03 at 3.04.20 PM copy2.png (2.22 MiB) Viewed 2900 times
Screen shot 2014-02-03 at 3.04.20 PM copy.png
Here's the result inside of Newton.
Screen shot 2014-02-03 at 3.04.20 PM copy.png (2.22 MiB) Viewed 2900 times
Screen shot 2014-02-03 at 2.59.20 PM.png
The initial comp. Orange circles have "wiggle(.2,200)" in their Position property.
Screen shot 2014-02-03 at 2.59.20 PM.png (57.77 KiB) Viewed 2900 times
 
Magua
Topic Author
Posts: 8
Joined: Sat Feb 21, 2009 11:08 pm

Re: Weighted Directional Random Movement

Mon Feb 03, 2014 7:17 pm

Also, I think another approach would be to limit the max values in two directions, and then customize those values depending on what area of the ring the shape is... so for instance, if it's in the lower right corner, place upper (smaller) limits for the positive x values, and the negative y values - but keep the negative x and positive y values as per the wiggle expressions' limits (ie: in this case, 200px)... dunno, just throwing it out there... thanks again in advance for any directions or solutions anyone has.
 
beginUndoGroup
Posts: 77
Joined: Tue Nov 27, 2012 6:41 am

Re: Weighted Directional Random Movement

Tue Mar 04, 2014 4:40 am

Hi,
it's very probably possible to do this with an expression, but that expression would have to to look back and recalculate for each frame all position values since the start of the animation.
With 20 shapes or so, you'll be in trouble just scrubbing the CTI.
But this is precisely the type of things Newton is good at, so if you have why not try to do everything with it ?

I don't have Newton and have never tried it, but i read it now also deals with electromagnetic force.
So maybe turn off gravity and play with electromagnetic properties of layers so that the border repulses the circles.

Xavier.

Who is online

Users browsing this forum: No registered users and 2 guests