Mailing List AE-List@media-motion.tv — Message #65895
From: Nathan Shipley <AE-List@media-motion.tv>
Subject: Re: [AE] Repelling layers
Date: Wed, 15 Jan 2020 10:15:04 -0800
To: After Effects Mail List <AE-List@media-motion.tv>
Henry,

Here's something really basic I just whipped up that simply moves layers away from a null.  It just pushes objects away from where the null is when they're closer than the "Distance Threshold" control.  You can increase the amount that they move with "Move Away Multiplier."

Just paste the position expression from one of the solids to your own layers and it should work or at least be a starting point to tinker further.  Expression pasted below as well:

Here's a quick screencapture showing what it does:

And here's the .AEP:

Not fancy but maybe helpful?
 - Nathan

p = transform.position;
nullPos = thisComp.layer("Parent And Controls").transform.position;
distanceThreshold = thisComp.layer("Parent And Controls").effect("Distance Threshold")("Slider");
moveAwayMult = thisComp.layer("Parent And Controls").effect("Move Away Muliplier")("Slider");

distance = length(p, nullPos);

if (distance < distanceThreshold) {
    distanceMult = (Math.log(distanceThreshold / distance)) * moveAwayMult;
    delta = nullPos - p;
    nDelta = (normalize(delta));
    newPos = p - nDelta * distanceMult;
} else {
    p
}


On Wed, Jan 15, 2020 at 9:13 AM henry birdseye <AE-List@media-motion.tv> wrote:
This is true. If I had any sort of budget at all this would be ideal.

About a decade ago, ways of doing this abounded on the interwebz...
those links have since passed on. Character Animator has a physics
engine I may explore.


On 1/15/2020 11:00 AM, Peter Lund wrote:
> Hi,
>
> i gutes you need something like this.
>
> https://aescripts.com/newton/
>
> a physic engine that helps you with the repelling and interaction.
>
> this is all I found under „physic“ topic …
>
> https://aescripts.com/search/?q=physic
>
> hope this helps you
>
> Peter
>
>> Am 15.01.2020 um 14:40 schrieb henry birdseye <AE-List@media-motion.tv>:
>>
>> I'm trying to get some layers to be repelled by a passing object, the links I've found for how to do this are years old and don't work properly.
>>
>> Paul Tuersley's project no longer exists at http://www.aenhancers.com/viewtopic.php?t=630 and that seems ideal for what I need to do.
>>
>> Can anyone help me find a setup I can kind of plug right into. This, of course, came as a last minute client request.
>>
>> HB
>>
>>
>> +---End of message---+
>> To unsubscribe send any message to <ae-list-off@media-motion.tv>
>
> +---End of message---+
> To unsubscribe send any message to <ae-list-off@media-motion.tv>

+---End of message---+
To unsubscribe send any message to <ae-list-off@media-motion.tv>
 
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to ListMaster