First I must say that I am very new to Maya, dynamics, and any 3d modeling in general. I am right now taking my first class in it.
I am trying to animate a claw machine claw that opens and closes. I want the "fingers" of the claw to be passive rigid bodies, so they can close around the active rigid items in the claw machine.
Right now I have each "finger" of the claw as a cylinder that's extruded along a curve. Each finger is in a realign group by itself, just to retain the object coordinate space to make rotation along one axis easier. The claw will open and close simply by rotating the fingers along their object Z-space.
Whenever I make one of the fingers a passive (or active, for that matter) rigid body, the finger snaps to some different location. Then, whenever I try to translate or rotate the rigid body finger, it moves in a straight line off into space. It does not move in the direction that I am attempting to translate it to it, either.
I read that rigid bodies cannot be part of a group, so I experimented with a standalone regular cylinder (not extruded along a curve). I first rotated the cylinder, then made it rigid. It still snapped to a different location upon becoming rigid, and displayed the same weird behavior when moving it.
Does anyone know what is going wrong? Am I missing something? Additionally, if there is a better way to simulate the physics of a claw machine without making the claw rigid like this, please let me know.
Try resetting the rigid body settings. There might be something in the initial settings area? Once you get a basic cube working as a passive rigid body in a new scene, then try on your claw. If the hierarchy is causing problems, try creating a proxy that is not visible but has a rigid body applied. Then apply a parent constraint with no offset from the original claw finger. Hope that gets you on the right track.
After making my curved cylinder (the claw finger) a rigid body, I reset the settings in the rigidBody input. Strangely enough, whenever I make it a rigid body, it gets assigned some random center of mass, like (106,0, -86). Even if I reset that to zero (making sure "lock center of mass" is off first), nothing changes. The little 'x' marking the center of mass stays in the same place.
When I make any other standard shape rigid, its center of mass is (0,0,0) and everything works.
Making a cube a rigid body worked right off the bat. I was able to break the rigid cube by first moving its pivot in the x direction, rotating the cube, then making it rigid. It then showed the same behavior as my claw finger.
I thought maybe this issue had something to do with rotations before making a body rigid, so I remade my finger with no rotations or translations. I just used my original CV curve and extruded a cylinder face across it. (Note that I DID have to rotate the cylinder face first to get it into position to be extruded). All I had to move was the pivot, since it was created far away from the actual object.
With the cleanly-built finger, making it a rigid body still showed the same behavior.
I am a little confused on your second suggestion of a proxy, but I'll see what I can do and give that a try.
I was able to replicate the issue I think, and interestingly it goes away if just rewind the playback. Give that a try.
Proxies are typically used to create lower res stand-in geometry to speed up simulation time, but you can use the same thing to get your transformations working. Simply create another object the same size and shape as your finger, move it into place and then create a parent constraint from the original geometry to keep it in the same place when the finger is animated. There should be some info online for doing the parent constraint.
Oh, you are keying something? In mine, I have nothing keyed in playback, and rewinding doesn't seem to change anything.
I had been working on completely reconstructing my claw from scratch when I was getting these movement issues. Now I tried making the fingers of the already-created claw rigid and they do not suffer from the weird snapping issue now. They do, however, have another problem that is important: their rotation attributes suddenly change, though the object does not move.
First I should explain how I created my claw (I've attached a picture of it for reference, as well as the claw hierarchy). I created the first finger (the leftmost one in the image), using the process I described earlier with the extruded cylinder. I created the "base" cylinder (the bigger one in the center) and attached the finger to that. The finger was placed in a group by itself (a "realign group," I think it's called). "Duplicate Special" of the realign group was used to translate the other two fingers in the right places.
At this point in time, each finger has the following rotate attributes (0,0,-110). The -110 is to raise the claw up to its position seen in the image. When I make the first finger (on the left) rigid, its rotation attributes stay the same. When I make the other two rigid, their rotate attributes change to (-180, 180, 70).
I just tried manually rotating the duplicated fingers, but their rotate attributes still snap to those odd values when I make them rigid.
Once the two "broken" fingers are made rigid and I try to rotate them, the object coordinate system is off. I can no longer just rotate the object along the Z axis only, as the X and Y coordinates snap between values -180, 180, 0 and 360 and no value in between. Being able to rotate the Z axis only is very important, as I need to key its Z-rotation to animate the claw closing.
I'll try doing the proxy parenting. Later on I am going to need to learn how to keyframe parenting constraints anyway to make the claw pick up objects.
In the mean time, would you happen to know why the rotation attributes are changing as I described? It could be in the way I am duplicating the fingers, since only the duplicated ones suffer from this.
I am using Maya 2014 Student Edition, so I don't think that the version is the problem.
I did manage to get my claw to pick items up using dynamic parenting constraints in a script. The claw fingers close like I want, but they aren't rigid. Since the parenting works okay, maybe the fingers don't need to be rigid. I don't notice them clipping thorough the picked up object at all.
Now all I need to figure out is how to get gravity to take over once the item in the claw is dropped.
Thank you for offering your advice on how to fix the rigid body issue. While I am still a bit confused about the rigid bodies, I think I have a better understanding than I did before!