Object rotation that accounts for point normals

   10863   2   0
User Avatar
Member
1 posts
Joined: July 2005
Offline
Hello everyone,

I've got a little problem that I'm hoping some of you will be able to help me with. I'm trying to set up a trail of dominoes that will align itself to whatever curve I draw initially. The curve is laid out so that a resample controls the spacing of the points as well as the total number. Normals were then added to the points so that the dominoes could have a direction to face in.

The dominoes consist of 4 sops…

grid_dom_# - simply builds the domino
xform_Y_dom_# - controls domino Y position
xform_pos_dom_# - aligns the domino to the respective point and normal
xform_rot_dom_# - rotates the domino around the point with a clamp function that is controled by a hidden circle that moves linearly

One thing I think I should dive deeper into is the fuction that aligns the dominoes on the normals.

in the Rotate Y channel of the xform_pos_dom_0 sop:
acos(dot(normalize(vector3(point(“../point_showme”, opdigits(“.”), “N”, 0), point(“../point_showme”, opdigits(“.”), “N”, 1), point(“../point_showme”, opdigits(“.”), “N”, 2))), (vector3(0,0,1))))

(and no I didn't write that myself all of that credit goes to a fellow student)

point_showme is just the final sop of the curve that displays the points and normals.


The problem I'm having, is that when I play the animation, the dominoes only rotate about the x-axis, which makes sense, because that's the channel I have the clamp function in on the xform_rot_dom_# sop. And that's great, as long as I'm doing a straight line out the z-axis
but, I'd like to set this up so that it will look pretty on any curve.

Here's the clamp rotation function in case it would help:

clamp(chf(“../crot/ty”, $F - opdigits(“.”) * (“../resample1/length”) * 30)), 0, 80)

crot is the circle sop that controls the domino movement.

So, any thoughts on how I could set the dominoes to rotate perpendicular to their normals would be greatly appreciated.

Thank you in advance,

Jared Hromika
User Avatar
Member
665 posts
Joined: July 2005
Offline
i'm curious as to why you are not using the copy sop?
User Avatar
Member
941 posts
Joined: July 2005
Offline
Sounds to me like you're complicating things a little too much – you shouldn't need to use any expressions to do this (well… maybe one; but that's if you don't want to use CHOPs)

Try this:

1. Build your curve with a curve sop followed by a resample sop (much like you're doing now). The curve can have any orientation, but start building one on the XZ plane.

2. Plunk down an Add sop with a single point at {0,0,0} and a single poly with one point {0}. Follow the add sop with a point sop and set it to “Add Normals”, and put the value {0,0,1} for the normal.

3. Put down a Sweep sop and feed the output of step #2 into its first input (“Cross Section”), and the output of step #1 to its second input (“Backbone”) – leave everything at default.

4. Build your domino (just one) sitting on the XZ plane (its height in Y, depth in Z, and width in X). offset it in Z (depth) so the edge doing the X-rotation is on the X-axis (so you pivot on the edge and not the middle).

5. Add a Copy sop, and feed the domino shape to its first input (“Primitives to Copy”) and the output of step #3 (sweep) into its second input (“Template to Copy to”). Get rid of “Transform Cumulative” (but keep “rotate to normals”). Now put the “tumble” expression in the Copy's RX channel – say something like “clamp($FF-($PT*30),0,90)” – or use CHOPs for completely “expression-free” dominoes!

… that's not to say you *can't* use expressions… but you'd end up pretty much duplicating the above, so it's not really worth it.
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
  • Quick Links