Page 1 of 1

Distribute layers in 3D Space

Posted: December 19th, 2004, 9:13 am
by Disciple
Expression created by Brian Maffit, posted to AE List
------
To place a single layer randomly in Z space, place this expression in the position stream of your layer :


dist = wiggle(0,5)+5; //generates a locked random value between 0 and 10.
[value[0],value[1],dist[2]] //applies value only to the z axis

Posted: January 24th, 2005, 12:43 pm
by byronnash
My geometry/trig isn't that strong, what do you think I'd need to add to keep the items in a spherical space?

Posted: January 24th, 2005, 2:33 pm
by Shinjipierre

Code: Select all

dist = wiggle(0,5)+5; //generates a locked random value between 0 and 10.

   //sphere
radius = 1;
center = [0,1,2];

   // 0 <= (X0-X)² + (Y0-Y)² + (Z0-Y)²  <= R²[/i]

var temp = (center[0]-value[0])*(center[0]-value[0]) + (center[1]-value[1])*(center[1]-value[1]) + (dist - center[2])*(dist - center[2]);
if ( temp  <= radius*radius ) {
     if ( temp  >= 0 ) {
            //It's in the sphere
     }
}

I hope this code could help you...
I don't really understand what you mean when you say : "keep the items in a spherical space"