Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Maxon Cinema 4D XPresso Question – Degree of Rotation Display

  • XPresso Question – Degree of Rotation Display

    Posted by Tony Barone on November 15, 2013 at 1:29 pm

    I have an animation where a “lens” is being rotated to different degrees 0 – 360. I have an XPResso setup with a slider controller to do this.
    I would like to also output the current degrees of rotation to a text display within the animation. I set this up as well in Xpresso, but it shows the degree of rotation out to the 3rd decimal place. Is there a way to get it to somehow round off to the nearest .25 degree of rotation on the text display? Or at least only show 2 decimal places?

    Thanks!

    Arturo Lazcano replied 11 years, 6 months ago 3 Members · 12 Replies
  • 12 Replies
  • Brian Jones

    November 16, 2013 at 2:55 am

    -you can delete all the decimals by running it through a Universal node set to Integer
    -you can get two decimals by multiplying by 100 then running it through a Universal node then dividing by 100 (or one decimal by using 10 instead)
    -you can use a Python node and run the input through a Round function to get 1 or 2 decimals in one step

  • Tony Barone

    November 18, 2013 at 4:44 pm

    THANK YOU!

  • Tony Barone

    November 18, 2013 at 8:58 pm

    Is there a way to also have it display a .0 when its not .1-.9? and/or add a “degree” symbol at the end?

    The problem is, this is to show the degree of rotation of an object, and I have the object stopping at different points which sometimes have a .5 and sometimes nothing at all, so if I were to add the degree symbol as a different text object, I would have to have it move closet to the number when theres not a decimal after it.

    Thanks again!

  • Brian Jones

    November 18, 2013 at 9:12 pm

    are you using xpresso standard nodes or are you using the Python node at all? And how many decimal places are you using in the display? the degree symbol should be easy.

    Either way this is the sort of thing you get in a lot of scripting when values are being returned with automatically rounded values (dropping the.0 for example) you have to detect that it’s missing then add it in with an if statement. I don’t know how complete the python interpreter is in C4D but it should be possible even in xpresso (but not absolutely sure of that…)

  • Tony Barone

    November 18, 2013 at 9:19 pm

    I’m using standard XPresso nodes, I don’t know the first thing about python.

    I have it setup as per one of your suggestions:

    Math Multiply (10) – Universal (Integer) – Math Divide (10) – Text

  • Brian Jones

    November 18, 2013 at 10:24 pm

    yes the degree symbol is easy, just pass the Math Divide (10) into Input [1] of another Math node set to Data Type – String, Function – Add and set Input [2] to be ° then pass that to Text

    Adding the .0 should be done the same way but testing if you need it is something else… I will see if it can be done

  • Brian Jones

    November 19, 2013 at 12:29 am

    yes, it can be done

    6810_xpressoroundwithdecimals.c4d.zip

    by taking the value that would go to the text then comparing it to a rounded (Universal:Integer) version of itself – if they are exactly equal (the Compare node) then the original value must not have trailing decimals and if they are not equal then the original must have decimals and the rounded version does not. Passing the true or false value to the Condition node lets us add the degree symbol if it already has decimals and ‘.0’ plus the degree symbol if it does not have trailing decimals.

  • Tony Barone

    November 19, 2013 at 1:19 pm

    Brian, thank you very much for your help! Especially for posting the file… not sure I would have been able to figure it out from your explanation. 🙂

  • Arturo Lazcano

    January 19, 2015 at 11:18 pm

    Hi,
    I don’t know if i’m been stupid or what. But i copy your xpresso nodes, replace your oil tank object, for my own object, but nothing happened.

  • Arturo Lazcano

    January 19, 2015 at 11:23 pm

    Hi,
    I don’t know if i’m been stupid or what. But i copy your xpresso nodes, replace your oil tank object, for my own object, but nothing happened.

Page 1 of 2

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy