Activity › Forums › Maxon Cinema 4D › How to make a xpresso rotation of object
-
How to make a xpresso rotation of object
Posted by Andrew Shishkin on October 17, 2010 at 7:15 amHow to make a xpresso rotation 90 degrees of object between 20 and 25 frames of each second (25 frames per second timeline)?
For example: cube still from 0 to 19 frames and ratates 90 degrees from 20 to 25 frames, next seconds action iterates up to any composition time.Alan Flood replied 15 years, 6 months ago 4 Members · 8 Replies -
8 Replies
-
Cory Petkovsek
October 17, 2010 at 11:38 pmWell that would take a long time to explain. Here’s a file I made. Open it up and look at the xpresso and ask questions. I assumed frame base of 0, so the box rotates on frames 20-24. Frame 25 is 0 thus does not have rotation. Adjust this in the modulo tag and condition tags.
I arrived at the additive rotation by taking 1 radian or pi (3.14159) and dividing by 2 for a 90 degree rotation, then dividing by 5 for the 5 frames it rotates.
1179_xpressorotatingcube.c4d.zip
Cory
—
Cory Petkovsek
Corporate Video
http://www.CorporateVideoSD.com -
Andrew Shishkin
October 18, 2010 at 8:56 amAnd how to increase angle accuracy, for example if i need 100-200 rotation cycles?
-
Adam Trachtenberg
October 18, 2010 at 3:23 pmCory covered the Xpresso setup, but if you aren’t aware, you can do this more easily without Xpresso. Just keframe one repetition of the rotation cycle, select the rotation track in the Timeline, and in the Attributes Manager, set the “After” parameter to “Offset Repeat”.
-
Cory Petkovsek
October 19, 2010 at 10:00 pmI’ve given you enough. Learn to fish! Either go with Adam’s solution, or breakdown what I gave you until you understand it and can replicate it for yourself. It’s not that complex. Then you will easily be able to answer your own question.
Cory—
Cory Petkovsek
Corporate Video
http://www.CorporateVideoSD.com -
Alan Flood
October 24, 2010 at 3:58 amHey Cory – that’s a very sweet setup there. Thanks for sharing it. I’m an intermediate xpresso user myself and always looking to improve my xpresso knowledge and things like this really, really help 🙂 I’ve always had trouble with setting parameters for degrees since there is no degree datatype in xpresso but now that I know that 1 radian = 180 degrees life will be a whole lot easier the next time some rotation related conundrum pops up.
There’s one thing I’m not %100 clear about and that’s the role of the condition node. Can I just check my understanding with you, if you don’t mind? It’s my understanding that this node is taking the result of the compare node and processing it in the following way: if the result is =>20 it switches from input 1 to input 2 and if the result is anything other than that it switched from input 2 back to input 1. Is that right?
Cheers,
Alan
-
Cory Petkovsek
October 25, 2010 at 11:15 pmHey Alan, I’m a beginning xpresso user, but I do have a computer science degree. 🙂
A condition is something like this:
if(test) then
do this
else
do something else
endTest must result in a boolean value; something true or false. “Do this” is executed if the result is true; “Do something else” is executed if false (or this may be omitted entirely).
C4D xpresso handles conditions in a rather clunky way, as shown in the file. “Test” is taken care of by the Compare node which tests if the value is >= 20. Originally I had another compare node to test if it is <25, but this is taken care of more efficiently by the modulo.
The Condition node works by inserting a boolean value into the switch input. If it is false (value=0) the first Input input is used. If true (value=1), the second input is used. Thus the additional radians are added if and only if the condition is true.
Technically Condition works more like a C switch operator, and is not limited to boolean values. You can put in inputs for different values that go into switch, 2 (3rd input), 3 (4th input), 4 (5th input)… However a boolean test is often cleaner to work with.
There is a spy node you can add which is pretty useful. Stick it in between any two nodes and it will display the value passing through it.
Cory
—
Cory Petkovsek
Corporate Video
http://www.CorporateVideoSD.com -
Alan Flood
October 26, 2010 at 2:35 amHi Cory. Thanks very much for the breakdown – that really does help a LOT and I appreciate you taking the time to explain it 🙂 This sort of stuff applies across a whole range of stuff, huh? I mean, I can see how this applies to AE expressions now too – the if/else aspect of it anyway. Maltannon explains some of this stuff in his tutorials but I dunno – I just never grasped it. Sounds simple enough and it probably is simple to you guys who have been working with such things for any length of time but it’s powerful stuff to those of us who don’t know too much about it 🙂 Exciting. Many thanks. I can already see many ways to put this to good use.
Kind regards
Alan
Reply to this Discussion! Login or Sign Up