# Create joint

Is it possible to create a joint like in the picture

My experience is with PhysX 3.2/3.3 so I’ll assume that’s what you’re asking about.

The closest analog in the joints provided would be the distance joint I believe. This would constrain some point on B to be a fixed distance from some point on A allowing B’s center to rotate about A while still allowing B to rotate about its origin. However this would have 3 rotational degrees of freedom where it looks like you only want 1 and I don’t think the distance joint can impose rotational limits. I suspect you could combine this with D6 joints to impose the additional cosntraints. e.g. use a linear constraint which prevents B from getting too close to A. Use a rotation constraint to reduce your 3 degrees of rotational freedom to 1.

When setting this up be careful to try and avoid redundancies in your constraints, i.e. don’t have two constraints which limit the same degree of freedom. At best it’s going to make your physics slightly more expensive and at worst it could affect the correctness of the solution the physics engine arrives at. That’s my understanding, anyway.

An alternative to all this is that you can implement your own joint. I have done this before by copying the distance joint and the system seems to work quite well giving better control over exactly what is constrained. It is non-obvious how it all works and there isn’t a lot of documentation around it so the barrier to entry is a little steep. You might prefer to try combining existing joints first to make sure what you’re asking for is actually what you want.

My suggestion is that you make a copy of one of the joints that come with PhysX and then start modifying it. The method that does all the interesting work is the SolverPrep

You modify the source code?

Why would you like to use one single joint? The simplest solution here seems to be to use two revolute joint and three rigid objects:

Object 1: the box
Object 2: the disc
Object 3: beam A-B

revolute joint 1:
-parent = the box
-child = the beam A-B
-location = point A
-make this joint limited

revolute joint 2:
-parent = the beam A-B
-child = the disc
-location = point B
-make this joint free

Hope this helps