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.
Please help me how create custom joint
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
In reply to Hd131:
Yes and no. The concept of a joint appears to be an extension on the PhysX concept of a constraint. A constraint is a low level, 1 dimensional physics engine constraint. Every tick the physics engine generates a big table of constraints and then solves the system to try and satisfy all the constraints as much as possible (presumably it’s more complicated than this but to a layman like myself that’s the idea). Joints on the other hand are a high level way of relating bodies to generate constraints. So a joint will create up to 6 different constraints representing the different degrees of freedom (Technically it could create more than 6 but probably shouldn’t). The joints that come with PhysX are part of the extension library which, even prior to 3.3, source was provided for. My suggestion was to create your own joint type based off one of the provided joint types. So yes, you would be starting from a basis of code provided to you by nvidia but you would not be changing any of the physx code that get compiled so you would be able to link against a clean distribution of physx.
In reply to JOT:
This would work but the question would be what to set the mass (an inertia tensor) of the beam to. In the example diagram it is implied that the disc and box are effectively connected by a massless beam. In PhysX this is not possible so you have to give the beam some mass. You might be tempted to just make the mass very small so it’s effectively massless. PhysX will let you do this but tends to be bad at solving the requisite forces if the masses are too disparate (ignoring PxArticulation). The PhysX docs recommend ensuring that two bodies connected by a joint have a mass ratio no greater than 10:1. You might be tempted then to split the mass of the disc between the beam and the disc so they each get half the mass but this would make it easier for the disc to rotate and also easier for the beam to rotate about point A. You could, of course, then tweak the center of mass of the beam to be at the location of the disc and double the discs inertia tensor to try and combat these effects but I suspect at the end of the day you’d never get something that matches the dynamics of the setup in the question. Of course the end user may never notice the difference so it’s definitely a good suggestion to try.