Distribute layers in 3D Space

Moderators: Disciple, zlovatt

Post Reply
User avatar
Disciple
Posts: 137
Joined: June 5th, 2004, 8:05 am
Location: Los Angeles, CA
Contact:

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
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

My geometry/trig isn't that strong, what do you think I'd need to add to keep the items in a spherical space?
Shinjipierre
Posts: 36
Joined: December 4th, 2004, 10:10 am

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"
Post Reply