Skip to main content
sinious
Legend
August 30, 2010
Answered

How can I use layer axis versus world axis to animate?

  • August 30, 2010
  • 1 reply
  • 2115 views

Hi all,

I'm open to alternate ways to approach this.

I'm trying to create a sphere using several images. Say, 200 images, arranged in 3d space so they face outwards and are all forming one large sphere. Pretty standard thing (like the glowing blue droid apps sphere in the android commercials, like this).

I used Red Giants PlaneSpace to quickly make a sphere. I wish to 'explode' the sphere so all pictures move away from the spheres center, but in a staggered and random way rather than all at once.

I thought this would be easier as I see each layers orientation changed each layers axis. Thus the the layers Z-axis points away from the center.

Example:

I tried using a simple linear expression to update the Z axis over 20 seconds to its current position minus 2000, like this:

amt=linear(time, index, index+20, position[2], position[2] - 2000);
transform.position = [position[0],position[1],amt];

This updates the Z-axis position but it's based on the world axis (or comp axis), not the layers axis. The layer axis I refer to is the axis widget that appears when you select a 3d layer and the red/green/blue 3-way axis widget appears.

How can I get the expression to use the layers axis rather than world?

Is there another approach to this? I'm definitely not up to date on 3d trig enough to write a formula to plot a course away from a specific 3d point. Hopefully there's a simple way to do it that I overlooked.

I will add that I did tie all of the 200 pictures to a null, scaled the null and it does push all the pictures away. I also added an inverse scale expression so they stay the same size as they originally were instead of scaling up with the null. However I really want to make them explode in a random fashion rather than "all at once" and I need to get away from the null scaling concept for that to have access to each individual picture.

Thanks!

This topic has been closed for replies.
Correct answer Dan Ebberts

Disconnect the layers from the null, and try this:


amt=linear(time, index, index+20, 0, -2000);
value + toWorldVec([0,0,1])*amt

Dan

1 reply

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
August 30, 2010

Disconnect the layers from the null, and try this:


amt=linear(time, index, index+20, 0, -2000);
value + toWorldVec([0,0,1])*amt

Dan

sinious
siniousAuthor
Legend
August 30, 2010

Wow that works great!

Does the 0,0,1 somehow 'select' Z-axis as the candidate to receive the 'value'? I assume 'value' is a property that can be set in an expression to assign something to the property you're adding an expression to (yes I'm that new that I don't know this stuff).

I did see toComp, fromWorld, etc as methods but I didn't have any real clear explaination in the reference on implementation beyond that they exist.

Thanks very much for the help!!

Dan Ebberts
Community Expert
Community Expert
August 30, 2010

[0,0,1] is vector pointing in same direction as the local z axis. toWorldVec() converts it to a vector in world space. "value" represents the pre-expression (i.e. keyframed or static) value of the property holding the expression (you can't alter it with the expression, you just reference it).

Dan