Jump to content

Animate object along Sweep


Recommended Posts

Hello,

I'm currently constructing a rollercoaster tool. ~The track is a curve and custom sweep SOP.

Problem is that I'd like to animate the cars down the same sweep as there is roll and twists so a standard path animation doesn't work.

(see image below)

Image link: http://img80.imageshack.us/img80/4753/sweep.jpg

post-1656-127618999873_thumb.jpg

Suggestions would be great...

Thanks!

N :)

Edited by chunkified
Link to comment
Share on other sites

How about having sweeping a line (with just two points) along your path.

You then should be able to control all the roling and twisting you need.

With the add sop you can reconstruct two curves out of the above result, just skip a point each time.

So now you have two curves that are close to each other and ocassionally roll a bit around each other, but never touch.

The first curve will be the animation path for you object, the second curve will be the animation path for a null. This null will then become the lookat object for your object. (kinda like constantely defining the up vector.)

You can probably add a little bit of noise to the path of the null in corners and turns, so the carriages seem to be not to steady. (or detect their speed in chops and mix in noise that way).

You could also try instancing entire carriages on a series of points with up vectors and everything set-up. Those points and attributes could be extracted from the above two curves you generated with the sweep-add combination. You can use a carve with an animated value, copy sop and timeshift.

- there's a video tutorial on the sidefx website doing pebbles and tank threads with sweeps, might help you.

Edited by pclaes
Link to comment
Share on other sites

Hey,

I tried the whole Look At constraint method and got the same result as the null was still flipping along the curve.

I have however by sweeping a line with normals, managed to get the coaster path curve with the normals pointing in the direction i'd like the cars to go. (see picture).

normalso.jpg

Is there anyway to extract normal direction as a set of rotation values that I could pass to somewhere else?

Link to comment
Share on other sites

It is usually not a good idea to align things with Euler angles (messy). But if for some reason you want or need to do it you can use the inverse sine, asin(), expression on each of the normal's components. Expressions use degrees, and VOPs use radians, so you may need to convert.

It's simple but there is a problem with flipping when values pass over pi or 180 degrees.

You can avoid that if you do a more complicated procedure that uses rotations matrices.

I have attached an example of it (play it). The example shows how to get rotation angles from a vector. The important part is inside the red node. The green switch node lets you try different motions. All the other stuff is just to set up the demonstration.

angles.hipnc

Edited by Macha
Link to comment
Share on other sites

what is Euler on up-vector approach?

did you experience any problems with that?

Sorry, I'm not sure what you mean. :(

Your example is better and more elegant but if Chunkified wants to have explicit rotation values from vectors for some reason, then this is one way of doing it.

Link to comment
Share on other sites

ah ok, i was thinking you are refering to my example so i didn't understand what does the upvector orienting have in common with Euler angles

i am sure that Chunkified wanted to extract rotations just to correctly orient path constraint, so custom up-vector attribute would be the way to go

Link to comment
Share on other sites

you can use primuv() expression to extract attribute from curve according to u value

(i don't recommend to use it with "N" directly since it seems not to be using custom point N)

here is quick example

PERFECT!! I was rattling my brain for hours trying to get this sorted!

It is usually not a good idea to align things with Euler angles (messy). But if for some reason you want or need to do it you can use the inverse sine, asin(), expression on each of the normal's components. Expressions use degrees, and VOPs use radians, so you may need to convert.

It's simple but there is a problem with flipping when values pass over pi or 180 degrees.

You can avoid that if you do a more complicated procedure that uses rotations matrices.

I have attached an example of it (play it). The example shows how to get rotation angles from a vector. The important part is inside the red node. The green switch node lets you try different motions. All the other stuff is just to set up the demonstration.

Your file is definitely getting stored away in my uber folder! :) lol!

What other uses for this are there?

Thanks for your help both of you.... Here's some videos of a very early version of the tool:

:)

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...