PDA

View Full Version : Problem with dynamics in C4D



djembeplay
03-27-2009, 08:13 PM
Anyone with Dynamics and some experience - perhaps you could give me a hand?

I'm trying to animate a chain... nothing fancy... but it's proved to be quite an unexpected challenge for me.

I'm trying to use dynamics, but am unsuccessful so far. Here is a scene file of where I'm at right now:

http://www.yourfilehost.com/media.php?cat=other&file=chain__not_working_.c4d

Any help is much appreciated.

Gord.T
03-27-2009, 10:40 PM
I can have a look at it tomorrow when I have more time. I spent a couple minutes with it, interesting setup.

I noticed all of the dyna links were keyframed so I deleted all of those and turned off the 'cog-back wheel center' and took it out of the loop while I continue testing it.

In theory it should work once it's figured out. It may be due to settings in the Solver Object and/or the collision settings of the Dynamics Tag. I also checked you normals, I forget are they supposed to be pointing in or out? Out I think, I'll check tomorrow.

Also make sure you optimized all of the objects to seal any loose caps. Sometimes they cause problems.

In the meantime, can you tell me what C4D modules you have? You could maybe use expresso to connect it all or even use bones if you have the mocca module, if you wanted to try a different approach. Anyways if it's still not running tomorrow when I get back to it, I'll have another look.

djembeplay
03-28-2009, 12:33 AM
Thanks!

I have all modules.

They were all keyframed from my last dynamics bake. I tried a few bakes with various settings - particularly various values in the 'oversampling' and 'subsampling' of the solver object. The highest I went was 8 and 16.

For some reason, the same thing keeps happening as seen in the bake that came with the project file - the links just fly apart right in the beginning around the driving cog.

In theory, the smaller front cog should spin, rotating the chain, which in turn spins the larger rear cog. There is a problem with the rear cog as well - it is supposed to collide (or spin around, to be specific) with the cylinder it's on, but it just passes through.

I'll set a higher sub-sampling rate and let it bake overnight... maybe that will do it. Oh, I'll optimize all my objects as well. I'm pretty sure the normals are all facing out - I'll check that as well.

Gord.T
03-28-2009, 11:05 AM
I had another look. First I wanted to determine if each element of the model was responding to the dynamics so I broke it down into these 2 elements with a gravity solver as a test. The single link should fall and collide with the fake cog. It didn't. So the rig wasn't working and no amount of baking was going to fix it at this point.

I used a lo poly proxy version of the cog (although it should also be connected around the middle) for collision because it requires less calculations than the original. At render time you would just hide it and keep the original cog, with no collision tag and out of the Solver, visible. Make the proxy a child of the original.

http://i179.photobucket.com/albums/w289/TheRaptor365/misc/chains.jpg



I noticed that no collision was taking place but the link did fall with gravity if the cog wasn't there so that suggests the EPS settings were too high on the solver so I brought them down to 1. (see EPS in the help file.)
Now the link collided with the proxy.

You may have to scale up all of the model parts if collision is still a problem.

Can I suggest you begin adding parts one at a time and testing, just a frame or 2, if they are working properly. Test the other cog on the right with the cylinder as a seperate test first to make sure it works then add them back with the rest of the parts.

If you keep doing that you should end up with a working rig, if it's going to work. There's a lot of calculations that have to go on and I'm not sure if C4D will get them all right, at the right time.

Maybe also consider using proxys for the links as well and also for the secondary cog at the right.

Here's my first test C4D file to get you started.
Hope that helps. Good luck.

Gord.T
03-28-2009, 11:23 AM
And if you didn't really care if the dynamics were accurate, you could replace the setup using a cloner and a spline wrap or something and maybe add a little expresso to make the links move in sync with the wheel.

I wasn't sure if you were going for an accurate sim or not. Just an idea.

triplej96
03-29-2009, 12:35 PM
Looks like Gord is here to help! From what I hear the dynamics module is horrible and very outdated. If you have the cash check out the silverbullet plugin from remo its great for Dynamics.

djembeplay
03-29-2009, 04:41 PM
Awesome advice raptor-

I was away yesterday but still had this project on my mind.... the idea of scaling everything up came to me as well.

Maybe I'm stupid, but those chain link actually are a proxy to a more traditional looking chain that I have modeled. I was trying to think of the most simple shape for the job...

I have another idea now that will simplify things much more. I suppose I will have to redesign that chain yet again. No biggie though. I'll scale it all up this time for simulation as well.

So it sounds like dynamics is basically meant for / good for simple dynamics like things falling on the ground and colliding with each other. Correct me if I'm off, though. A chain, on the other hand, has a whole string of things happening that will hopefully interact with each other as expected.

As for buying another add-on, I couldn't do that. I don't have the finances. Plus, I don't really want more add-ons right now. I feel like I still have so much to learn in C4D...

I like the idea of cloning and spline wrapping. I'm not familiar with Expresso or Mograph yet, so it would be a learning lesson. I tried using a spline originally, actually... but it didn't work out. I cloned all the chain links along the spline path, but couldn't get them to line up correctly. Then getting them to spin was another story... I tried to use spline dynamics around two spinning cylinders... but no matter what I did, the spline wouldn't rotate, it would just sit in place while apparently the cylinders slid underneath it.

So, ya, anyways... I'll report back. Thanks again.

djembeplay
03-29-2009, 08:18 PM
Alright... I suppose I'm done with trying to do with with dynamics.

I just spent hours re-designing a more simple chain system only to have it once again fail repeatedly. Bummer.

So... what is the most common way people animate tracks, chains, etc.?

Gord.T
03-29-2009, 08:39 PM
Now that you mention it, I just tried a spline version, only took a few minutes actually...

Here's a spline version I did real quick using a cloner and a spline with a single dyna link.
Once the link was cloned I had to rotate the link around using the Cloners Transform tab to get it facing the right way. I also had to set the Axis to Center for the link so that when it moves around the cog area the center would stay on the spline, otherwise one end would flip out too far.

Have a look at the Cloner settings. The count value of 51 was acheived by increasing until the links looked like they were connected, trial and error.

I also notice with your dyna links, if you look in the Corrdinates Tab of the Attributes you will see some really low values in the Scale fields. (0.015,0.03,0.028). Not sure how that happened.

In my sample, I set those scale values back to 1 and manually scaled the link with the scale tool.

To animate the track in my example, select the Cloner - Object tab - and animate the Offset parameter. (I already animated it a bit, just srub the time slider).

If this were a tank tread, from a distance you wouldn't be able to tell the links weren't really connected.

You can also animate the points of the spline to give it some bounce.
Anyhooo maybe this will give you some more ideas.

djembeplay
03-30-2009, 09:59 AM
Niiiiice - that's the way to do it. That worked perfectly.

I shouldn't say I'm completely unfamiliar with Mograph - I've used it minimally. But, I am still distant enough with it where I don't think to use it when attempting to solve challenges like this.

It looks fairly simple to use compared to other modules, no? Sort of like throwing different effectors together and balancing them to achieve different results.

Well thanks again for the help Raptor. Am I going to have to start paying you pretty soon? :-)

Gord.T
03-30-2009, 12:26 PM
hehe.

Mograph is a pretty powerfull module. I haven't used it that often myself but am starting to for the , cough, motion graphics, stuff. Easy enough to use also.

Oh, more about the cog wheel. To get the links to rotate in sync with the cog you'll need some expresso with a little bit of math. If it were a tank tread you'd also want the links to stay on the ground and not look like they were sliding.

Basically you can do that by calculating the length of the spline and the radius of the cogs and go from there. Maybe later this week I'll make a setup for the cog. The tank treads are a bit more difficult because you have 3 axis of direction both forward and backwards.
There may be some tutorials out there for doing that but I haven't seen them personally.

Also, for chains, hanging chains maybe, I'd have a look at using bones, joints actually, or maybe using stiff cloth links with the mocca dynamics instead of the Dynamics module.
I'll have to play around with that soon too but I don't want to get too sidetracked right now from my current projects. C4D is a cool program though.

djembeplay
03-31-2009, 01:29 PM
I'll have to pick up an expresso tutorial I suppose - it sounds pretty handy for things like this. For some reason I am super intimidated by the interface... personal walls I suppose.

I'm not sure what you mean about using joints for the chain - do you mean as an alternative to the way we did it (with the cloner)?

Gord.T
03-31-2009, 05:30 PM
Xpresso can take a little while to grasp. There is an expresso manual in the C4D help but it's bit hard to find. Help-Manual-Cinema4D-Xpresso. I wouldn't worry too much about XGroups at first, they're not used that often. You should find a bunch of xpresso examples online also.

I mentioned trying joints for a hanging chain, kind of like what would be used for a dogs tail for example. I wouldn't use it for the links/tracks that you have, the cloner works fine for that.

You could use the cloner for a hanging chain but if you wanted wind to affect it for example, you could maybe try joints, or maybe not. There's often more than one way of doing something and sometimes a different method may have more advantages over the other for a given situation is all I'm saying. :)

djembeplay
04-01-2009, 01:56 PM
Ah, I gotcha.

It seems like there are a bunch of different 'nodes' in xpresso - are they relatively intuitive to understand their function or is it like learning a new language?

Gord.T
04-01-2009, 02:40 PM
They're fairly straight forward unless you start getting into matrices which it helps if you already understand them mathematiclaly first, but there's info out there on those anyways.
The trick is getting to know what nodes are available and what they can do.

The Result node I use a lot. It allows you to check output values from other node ports while your building. The Math node as well to add,sub,mult,div found in the Calculate category.

One thing though, if one of your nodes has an error, like if you have an object dragged into the editor and you later delete the object without deleting the node, then the node will be invalid and should show up as yellow although sometimes it doesn't. But nothing in the editor will work until that node is replaced or deleted so watch out for that sometimes.
Usually you can tell if something is wrong when the Result nodes no longer report values.

Here's a simple example that calculates the length of a circle spline although it'll work with any spline.I'll include a scene file as well.

-Create a spline object for test, here, I used a circle with a radius of 50.
-Create a Null, add an xpresso tag and dbl-click it to open the xpresso editor.
-Drag the spline object into the editor.
-Click in the red area of the node to open the output nodes list and select 'Object'.
-R-click in the editor and select New Node-Xpresso-General-Spline.
-Click in the blue area of the spline node to select the input ports list and select Object.
-Connect the Circle node Object outport to the Spline node Object input port.
That allows you to retrieve additional data on the spline.
-Click in red area of the Spline node and add a Length output port.
-Add a result node so you can monitor result values, New Node-Xpresso-General-Result.
-Connect the Length outport to the Result inport to view the value.

For a spline of radius 50 it reports 313.971, although it technically should be 2(pi)r = 314.159. I can't account for the slight error, whether it's an actual or reported error,(probably because it's not an ideal circle-it has edges) but if more accuracy is needed then a coffee node can be used with some c++ math instead.

djembeplay
04-04-2009, 04:17 PM
I started playing around with expresso. Surprisingly I found it not as daunting as I was making it out to be - it's pretty fun actually.

So, now I have my chain rigged up to my bike just how I needed it to be.

Thanks again Rap.