Jump to content


BLSmith

Using Rotation to Drive Position

Recommended Posts

Hi all. I have the (gray) gear rotating the (yellow) nozzle, and my goal is to automatically move the (white) tappet without using keyframes. Here is a gif on what I'd like to achieve: 

 

giphy.gif 

If someone would be willing to help me, I'd very much appreciate it. I've attached my project file below:

 

Thanks!

 

-Edit: This file is the latest file as of 3PM CST 5/22/18.

Nozzle_and_Tappet_Question.c4d

Share this post


Link to post
Share on other sites

No problem. You already started with xpresso, why not continue in the same fashion?

Here I made a dummy example of what I mean. Maybe you'll need more elaborate solution.

Caclculate the distance between spinning nozzle and the white tappet. And keep that distance very small or 0.

 

Cheers.

rotate_me.c4d

Share this post


Link to post
Share on other sites
  • Topic Author
  • Hey Johnny!

     

    Thanks for the file and reply!! Two questions:

    1. My tappet (the thing that moves up and down) "bounces" when it reaches its lowest position. Any ideas?
    2. I moved my tappet from facing at 45' degrees to 0 with the idea that I'd only animate the Y-axis as you did, however, upon creating a null and nesting the tappet under it, I can't seem to find a way to time the tappet to go up/down at the proper time. Thoughts?

    Here's a video expanding on my questions above if you'd like more clarity: 

     

     

    Share this post


    Link to post
    Share on other sites

    Here are some comments:

     

    1, it seems to me that "collider" aka the spinning object is low poly. Faceted. This makes the tappet bounce probably.

     

    2, tried on my file to disable xpresso, rotate the thing 45 degrees, enable again and it basically just bounces up and down in world Y axis (orange arrows). Instead it should be moving along object's Y axis (green arrow). I think you'd have to use xpresso to drive also X position of the tappet. Because when you move the tappet along its Y axis, both X and Y values change.

     

    This example was just to demonstrate the idea, maybe others have different solution, but clearly you need to expand the xpresso setup for your case if you want to use it.

     

    screen.jpg

    Share this post


    Link to post
    Share on other sites
  • Topic Author
  • Thanks for your reply, yeah I think we'll have to see if anyone else has any ideas then because as of right now I am completely stuck. Ideally I'd prefer not to remodel the collider/nozzle thing. What I imagine is:

     

    Rotation angle of Camshaft-Start: -10254.226 °

    Rotation angle of Camshaft-End: -10614.226 °

    Total Rotation: 360°

     

    When at Camshaft-Start, Tappet Position at: 

    • X: 62.836 cm
    • Y: -28.032 cm

    (Option A): When at Camshaft End, set position of tappet to:

    • X: 69.087 cm
    • Y: -25.077 cm

    (Option B): When at Camshaft-End, Move Tappet 6.915 cm from the green handle:

    • image.png.8c53dafa4dae913e385ed76b407f2f21.png

     

    Then have some operator in the xpresso dynamically adjust the X/Y position based purely on the rotation, rather than creating a bounding box. Thus preventing the "bounces" entirely and is 100% dependent on the rotation of the collider/nozzel/pointy-thing.

     

    I'm just guessing though and look forward if anyone else has any ideas!

    Share this post


    Link to post
    Share on other sites

    Aw man - I thought @MJohnny's solution was brilliant - the bounding box thing was genius ! :)

    So is the reason that you don't want to use this method because your camshaft isn't its own separate object ?

    If so, you don't necessarily have to remodel anything - just split the cam rotation bit away from whatever is altering its bounding box, right ?

     

    Is the same engine we were talking about earlier - if so I could have a look and see what's what...

     

    CBR

    Share this post


    Link to post
    Share on other sites
  • Topic Author
  • Hi Cerbera. Johnny's solution is indeed great! I just came up short trying to rotate it and prevent it from bouncing. I've stripped the model down to its bare components so that I can share it here if that helps. 

     

    GEAR_QUESTION_C4D_CAFE.c4d

     

    Edit: Yes it is the same ol' model we were working with earlier :)

    Share this post


    Link to post
    Share on other sites

    The problem remains that in this file not everything  has its axis in the right place :)

     

    I think you can still use MJ's original plan, but instead of calculating the bounding box of the entire cam shaft, you can split those bits up so they each have their own bounding boxes (and are children of the rotating shaft), and we can utilise nulls to make the Y positioning of the tappets work at that position in the scene.

     

    The only thing I can't quite understand or ameliorate is why the rotation values are so madly high in your calculations...

     

    CBR

     

     

    Share this post


    Link to post
    Share on other sites
  • Topic Author
  • Hey Cerbera! 

    • Axis's: Agreed! I've been moving the axis's as I've needed to. However the Camshaft assembly axis seems(?) ok and I'll adjust the axis's for sure as we need to. My original model has 700 parts, all with axis's at 0,0,0. So it's been fun resetting these guys.
    • Bounding Boxes: I've removed one of the nozzles from the camshaft assembly using "split," but the tappet still bounces and I'm not sure how to time it correctly.
    • Utilizing Nulls: The main thing I'm a little stuck on understanding. Would you be willing to elaborate a little more? 
    • High rotation values: I only recently started learning xpresso, and what I have currently works: I have a drive gear that runs at 50% the speed of the camshaft assembly and the math is indeed high, but it does rotate at 360', and while it is not an ideal number, I've been taking the "Make it work first, make it work better later," approach. Indeed it is something I'd like to look at down the line. 

    Video version of my reply for context:

     

    Share this post


    Link to post
    Share on other sites

    So I finally played with my setup for a while and since the tappet is not well synced with the rotating part, I made a copy of it which is hidden from rendering (used solely for xpresso purpose) and rotated it slightly for desired effect. It is still not 100% accurate, but at least the parts are not intersecting.

     

    As I mentioned, the X position must be driven by expression as well for the tappet to move along its Y axis only, but that's easy for 45 degree tilt as the ratio is always 1:1.

     

    I hope you can use some of the improvements for your situation.

    rotate_me_tilted.c4d

    Share this post


    Link to post
    Share on other sites
  • Topic Author
  • Thanks MJ for the reply. So I've gotta say I'm still a bit confused on a few issues:

    • Your tappet bounces (like mine did). Is this because we're using a bounding box on a model that isn't 100% smooth? As a layman, I'd suspect the easiest way to do this smoothly would be to correlate the cylinder's current rotation value to the distance from the axis center respective to the X/Y, thus negating the need to reference jagged bounding box points.
    • Your tappet ether is hovering several cm above the cylinder in its maximum rotation value, how can that be smoothed out? Adjusting the constant didn't work.
    • I think I have an idea on what the hidden cylinder is for, but don't understand why it's essential. 
    • I don't know how to translate your xpresso to my model (attached) because my X/Y values are not identical. 

    Video version of this reply:

     

    I've attached a slightly more optimized version of my model, if that helps: 

    • Split all nozzle objects from original model. 
    • Adjusted axis on nozzles and tappets. 

     

    GEAR_QUESTION_C4D_CAFE_V2.c4d

    Share this post


    Link to post
    Share on other sites

    Hey, I'll  try to clarify some things.

     

    - bouncing may be caused by a less detailed structure of the rotating part as you can see in the picture. Subdivided surface may be one option do eliminate it. Bouncing may not be visible at all when the engine runs full speed.

    - there is a space between tappet and rotating part at one moment, but i can't think of a way to eliminate it without the 2 parts intersecting in other positions. Hopefully your camera will be placed such this space won't be shown.

    - delete the hidden cylinder and you'll see why its good. We are using its bounding box for xpresso.

    - your tappets are not at 45 degrees, in my case they are so Y=(-X) Surely, you can come up with formula that will drive X,Y coordinates in your case.

    mesh.jpg

    Share this post


    Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

    • Recently Browsing   0 members

      No registered users viewing this page.

    ×