PDA

View Full Version : Rigging of a cardan shaft


JoeLaFrite007
28-02-2011, 08:53 AM
Hi all,

Next Aramor's wip and his rigging problems, i'd tried to rig a lego-like cardan shaft... and it makes 2 days that i'm breaking my head on it without real progress :wall:

I'd created this test scene :

http://pjlap.pagesperso-orange.fr/Images/QuestionCardan01.jpg

* X rotation of the Red piece is wired to X rotation of the Blue one.
* The yellow piece is simply linked to the red one.
* A point is simply linked to the blue piece (this point represents the connection axis position).
* I'd added a LookAt constraint to the yellow piece, the target of the LookAt is the point.

Actually, when i'm rotation along X the red piece, the blue one turns corretly. I can modify the Y rotation of the blue one, the moves are perfect.

But the yellow piece...makes funky things ! It seems it's pasted to the blue piece and due to this, it's crossing the red part (hierarchy seems dead at this moment).

http://pjlap.pagesperso-orange.fr/Images/QuestionCardan02.jpg --> http://pjlap.pagesperso-orange.fr/Images/QuestionCardan03.jpg

I don't know if i'm on the right way or not so every solution will be good :dance:

The Prime
28-02-2011, 09:47 AM
Hi,

I can say with some confidence that it is to do with your LookAt constraint, fighting against the link to the red piece.

Instead of "simply linking" the yellow piece to the red piece, try using a position constraint.

The problem with giving you advice this way is that it's much easier to do if I had the file. If you have any way of uploading the file then do so, and I could take a look at it, and diagnose the problem with more ease.

JoeLaFrite007
28-02-2011, 09:56 AM
Yes i can ! here (http://www.cijoint.fr/cjlink.php?file=cj201102/cijPGPsCCs.zip) it is. (this will bring you to a french hostfiles site --> clic on the TestCardan.zip link)

Thanks a lot for your help !

The Prime
28-02-2011, 10:40 AM
Woot, solved! (I think)

Change you LookAt constraint from "Axis Align" to "look at"

Then set your source axis to X.

Hope it helps. The Lookat constraint can be a pain to use, so advise you do more reading on how it works, so that you can understand what you were doing wrong, and why the changes I made worked.

JoeLaFrite007
28-02-2011, 02:44 PM
:hmm: it's not perfectly working at home...

That's very close from what I want but there's still a little move inside the "arms" of the red piece. Look : it's not staying correctly in the middle as in the blue piece...

http://pjlap.pagesperso-orange.fr/Images/QuestionCardan04.jpg

I'd done what you suggested (reading the help associated to this constraint) but not founding what i'd really wanted :hmmm:
I read the Position Constraint help too...and i didn't understood a lot of things...

Buzzy
28-02-2011, 03:13 PM
This is what is called a "universal joint." The immediate problem I see is that you wired the X rotations of the two main shafts. But a universal joint is NOT a constant-velocity joint. So, if you rotate the red shaft, the blue shaft does NOT rotate at at the same constant speed.

The Prime
28-02-2011, 03:36 PM
Hi,

I've looked a little closer at the geometry, and I realise the problem is that the geometry itself wouldn't work. If you closely inspect the geometry, you will realise that the position the yellow object is in (in your screen shot) cannot be improved. If you tried to rotate it into position to be correct, you would have to move it out of the correct position on the blue object.

In the real world they aren't solid fused objects, but have a little 'give' in them. The 3D geometry however does not have any give, so it appears to be wrong.

Position constraint - The object only follows another objects position. If you directly link the objects, you make one the parent. This means that the child object does all of it's movement in relation to the parent, and if the parent object rotates, the child will follow.

The Prime
28-02-2011, 03:36 PM
What Buzzy said - I didn't know that but now it makes sense as to why yours doesn't look correct.

JoeLaFrite007
28-02-2011, 03:52 PM
Thanks Buzzy !

Yes, you're totaly right about the speed between the engine axis and the receptor axis... I'd found on the web physic courses that are explaining the basic concepts : i'm gonna find the speed formula for the blue piece ;)

@The prime : You're right about the little "play" between 2 mechanical pieces but in reality, these pieces are quite accurate : they all are guided with guiding issues (needles rolls, ...)
The problem comes mainly from my direct wiring between red and blue... And in this 3d simulation...the "play" is very big lol !

let's play a bit with cos, sin & tan :D

Buzzy
28-02-2011, 04:28 PM
You don't need any formulas or trigonometry to set up this system. Just some creative use of look-at constraints. Here is a crappy diagram. Hopefully you can make sense of it. If you have questions let me know. I have an animated gif of this rig in action, but I can't upload gifs to this forum. Sorry.

The Prime
28-02-2011, 04:30 PM
Awww man, I've spent about an hour on this trying to figure it out, and Buzzy comes in and steals my thanks! git :P

JoeLaFrite007
28-02-2011, 05:54 PM
Wow, i don't understand your diagram at all :o, I need serious explanations !

Buzzy
28-02-2011, 07:07 PM
Haha ok Joe. Let me explain. Let's call the bottom shaft the "input" shaft. It corresponds to your red shaft. The top shaft is the "output" shaft, which corresponds to your blue shaft. And the yellow thing is called a "gimbal"....i think. Let's call it a gimbal anyway.

First, create helper #1. It should be placed directly along the gimbal's axis which attaches to the red input shaft. It is the X-axis in my example.
175354


Second, create helper #2. It should be placed directly along the blue output shaft's long axis (around which you want it to spin). It is the Z-axis in my example.
175355


Next, link helper #1 to the input shaft (using the 'Select and Link' tool)

Now, we can set up the two Look-At constraints.

First, add a Look-At constraint to the gimbal, targeting helper #1. Under 'Select Upnode,' uncheck World and set the target to be helper #2. Set the Upnode Control to 'LookAt.' Now, you may have to fiddle with the LookAt Axis and Source Axis until they work properly.
175356


Now, add a Look-At constraint to the output shaft, targeting helper #2. Under 'Select Upnode,' uncheck World and set the target to be helper #1. Set the Upnode Control to 'Axis Alignment.' Again, you may have to fiddle with the LookAt Axis and Source Axis until they properly.

EDIT: Correction. The output shaft's UpNode should actually be the gimbal, NOT helper #1. I had this correct originally, but inexplicably changed it when I made these screenshots.

175358


And bingo. A rigged u-joint. Rotating the input shaft will rotate everything. Moving helper#2 will bend the joint.

JoeLaFrite007
01-03-2011, 05:36 AM
This is what i call serious explanations !!! (And what a beautiful tutorial you'd written ;) )

100 thanks for you !!!

I'd applied what you explained and it works perfectly in spite of the EDIT subject : When i'm setting the upnode of the Output shaft to the Gimbal, I can set all the combinaisons of Source and Aligned to Upnode axis ; the ouput is "locked" (if I rotate the input, the ouput is deadly static).
But when I set the Upnode to the helper #1 (with correct axis settings), everything is fine !!!

Thanks you very much for your help !!!

(That's just awesome ! I'm actually rotating and rotating my input shaft like a child with a new toy :D)