# Constrain joint to path

#1

Hello everyone,

I’m trying to learn the basics of rigging/constraint driven animation. For this I’m trying to animate a simple radial piston engine.
I used these tutorials as a start:
But I have trouble setting up some of the constraints…

(Please see attached sketch of a very simplified mechanism)
The Bone is a placeholder for a piston rod. It’s base (1) is attached to the circle, rotating around the center ©. So far so good.
Now I want the top of the bone (2) to move only along the direction of the second linear path §, while maintaining it’s length (the curve only defines a direction not the extends of the motion).

I tried “everything” Point and Aim Constraints, motion path etc, but can’t get it to work.

Any help is greatly appreciated.
(You can download this simple *.ma if you’d like to play with the problem)

kind regards
Christian

PS: If you think that cgsociety is not the right place for beginner questions, please leave a link to a more appropriate forum

#2

HI
Assuming that the circle is the crank shaft, the bone you have placed as connecting rod of the piston,
you want the connecting rod to be connected to the piston and the crank shaft.
You need to have a point on on the crank to which the connecting rod big end is to be attached:
Select two edge on the crank where the big end of the connecting rod has to be attached.
and run this script﻿. Now attach the Joint 1 to it .
Similarly attach the top end of the connecting rod to the Rivet created using the same script or simply to the connecting pin of the piston (since it would not rotate).
Now you will get the desired motion.
Regarding the constant length of the connecting rod the model measurement has to be well calculated and accurate.
Or else the connecting rod being skinned to joint 1 and joint 2 will stretch.
(rotation of the crank + the translation value of the piston should always keep the constant distance between the piston connecting pin of the piston and the attaching point of the big end of the connecting rod to the crank)
Note:
Connect using Point constrain if you do not get desired rest use parent constrain and then select the rotation rx, ry, rz and do break connection.
Regards,

#3

Hi shinyprem,
thanks for your extensive answer. Unfortunately you didn’t cover the central problem of constraining the movement along an arbitrary axis (or I didn’t understand).

In the end I managed to solve my problem with the help of this video about spline ik and I’m satisfied with the result…

regards
Christian