Jump to content

Sign in to follow this  

Xpresso Increment Node

Recommended Posts

Hello guys 
im trying to make a car with two wheels, and trying to make those two wheel rotate dinamically with the car movements on the X,Z  axis, 
the problem i have is that i need a node or system using xpresso to get increment a value(distance traveled per frame) so i can get the whole distance traveled through the timeline and whatever the direction of the car is, 
so to make more simple i did a screen, what i want exactly is something that gives me the amount increment of the value in circle in every frame, 
like ((distance in frame 0) + (distance in frame 1) + (distance in frame 2) + (distance in frame 3) + (distance in frame 4) + ...........(distance in the current frame))


Share this post

Link to post

It's hard to tell the issue from just this screenshot, without knowing more details, especially about "Travelinger"...

Here's how I'd do it:



And here's the scene file: test_xpresso_distance_per_frame_2.c4d


Share this post

Link to post
  • Topic Author
  • Hello Sir 
    thanks at first 

    what am i trying to do is to have a tyre of a car  rotates wherever the car goes, the wheel rotates correctlly, 
    and i found that the only way to do it is to calculate the distance traveled until a certain frame,

    using the distance between each two frames (ex:T1,T2 or T22,T23) and then calculate the sum of all the previous values, 

    my prblem is that i dont find a node that calculate the sum of the distance values, 

    how can i find a node like that ?



    Share this post

    Link to post

    My recommendation would be to make use of a User Data parameter as storage for the distance travelled and simply sum the distance per frame into this.

    For example it could look like so:


    The additional Time/Equal/Condition node group is needed to reset the distance on frame 0, otherwise it's pretty straight forward. The "Distance Travelled" port is the User Data parameter of type Real added to my travelling cube, but you could add this parameter to basically any other object or tag you like and see fit.

    And the scene: test_xpresso_distance_per_frame_3.c4d


    Share this post

    Link to post

    You can add incrementally by reading the current rotation value and adding to it every frame




    distance is always positive, so only works for the car going forwards. There's some clever code written by Base 80 that allows for forward and reverse. You make your wheel a child of the Base80 wheel eg






    adjust the Base80 wheel to same radius as the real wheel. Only move Base80 wheel by parent null.

    Edited by jed
    more info

    Share this post

    Link to post

    All above solutions can work great, and here's my input:

    I'm using a Tracer Object, to trace a Cube (Turn Off Trace Vertices in the Tracer Attributes). This will generate a Spline and record the Cube's Trajectory (You can animate the cube by any means and I have chosen a Vibrate tag because I'm lazy).

    Then we use XPRESSO to read the length of the Tracer Spline, as it reflects the distance travelled.

    I use that as an input to a Range mapper that takes the Circumference of the Wheel (2*Pi*Radius), and maps that to one Radian (Negated because the wheel is going "the other way").

    I then put that back into the Wheel P Rotation as Radians (Default Rotation Unit for XPRESSO).


    I also use an "Align to Spline" Tag to align the wheel to the end of the spline, and set it to Tangential so that it follows the Spline Tangent and orient itself. The Tracer offers the ability to create wheel tracks as well.


    Distance travelled 01A.c4d

    Share this post

    Link to post

    Interesting use of Tracer @noseman - no need to use pi twice though...



    Share this post

    Link to post


    Note to myself: Hey noseman, it's because a Radian includes the Pi already... TWICE.  That's why Radians are the default rotation unit...

    Thanks Jed...

    Share this post

    Link to post

    @noseman I've actually seen solutions to the car wheel problem using the degree node twice, and bringing 360 into things 😁


    For any radian noobs - a radian is the angle at the centre of a circle when the arc equals the radius. In this pic the red X is distance travelled by the car. Solving for A gives


    angle = distance / radius




    pi is defined by circumference = 2 pi R, but since we are not bothered about complete wheel rotations, pi doesn't really come into this calculation. Radian does not 'include' pi IMHO.

    Share this post

    Link to post
    1 hour ago, jed said:

    ..pi doesn't really come into this calculation. Radian does not 'include' pi IMHO.

    I meant that in the sense that 2π radians is equal to 360 degrees. So for a full rotation of the wheel, we have 2 Pies... hence the pie is very tasty.

    Just in case I wasn't clear.

    Share this post

    Link to post

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    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.

    Sign in to follow this  

    • Recently Browsing   0 members

      No registered users viewing this page.

    • Create New...