I’ve produced a problem with a prismatic joint that just ignores it’s limits. Anyone have any idea what might be going on here? Linked is the pvd recording.
Also is there or has there ever been a way to determine the amount of force generated by a constraint. I’m trying to figure out the tension in a rope made of stiff constraints.
I’m afraid I cannot connect to that website, there is some problem with certificates, or unsafe Java, or something.
From the User Guide:
The joint may be configured to report each frame the force that was required to hold it together. To enable this behavior, set the joint’s reporting flag. The force may then be retrieved after simulation with a call to getForce():
The force is resolved at the origin of actor1’s joint frame.
Note that this force is only updated while the joint’s actors are awake.
I have been experiencing a similar issue with the prismatic joint. The JointLimitPair is only valid for some world space ‘x’ direction. Regardless of the local pose of the joint, or the pose of the corresponding actors.
I created this gif where two are connected by a prismatic joint with a non-zero spring value. The two shapes rebound back only at first. Once I apply a torque to the one RigidBody the maximum distance between them continues to grow. When they are vertical they will never rebound.
Here is the relevant code:
PxRigidActor* pRA1,* pRA2;
PxTransform pform = PxTransform::createIdentity();
pform.p = PxVec3(0,5,0);
pRA1 =PxCreateDynamic(*gPhysicsSDK, pform,geo,*defaultMaterial, 1.0);
pform.p = PxVec3(0,5,0);
pRA2 =PxCreateDynamic(*gPhysicsSDK, pform,geo,*defaultMaterial, 1.0);
PxTransform local1 = PxTransform::createIdentity(), local2= PxTransform::createIdentity();
local1.p = PxVec3(0,0,0);
local2.p = PxVec3(0,0,0);
pJoint = PxPrismaticJointCreate(*gPhysicsSDK, pRA1, local1 ,pRA2, local2);
limitPair.spring = 1.0;
limitPair.restitution = 0.0;
*I’m using the PhysX 3.2.3 version. I will try with an older version to see if it is only a recent issue.
I am having the same problem and so does the user in this thread https://devtalk.nvidia.com/default/topic/772673.
The limits seem to always be related to the global x-axis no matter what the global axis the prismatic joint works on is. If actors are constrained to global x-axis limits work fine, but if actors are constrained to another axis the limits will still be on the global x-axis. The actors will then be limited in motion so that the projected position of the actor onto the global x-axis will never go outside the limits.
I believe this is a bug and it seems to have been around a while. Does anyone know if this problem has been acknowledged by Nvidia?
–> If actors are constrained to global x-axis limits work fine, but if actors are constrained to another axis the limits will still be on the global x-axis.
I suspect that the problem is coming from when the joint is first set up. Could you post a snippet to reproduce this problem? Also, please try it using PhysX-3.3.2 if you haven’t already.
I just tried with 3.3.2 and have the same issue. In my tests I am using code similar to code in post 3 in this thread. I have no simple isolated example. I am setting the local pose in joint for actors to change the axis to constrain to. Do you know if there is a simple sample example with a PrismaticJoint that I could modify?
Just to be clear. The axis that actors are constrained to is as expected, only the limits are the problem.
Could you post a PVD capture?
Here is a PVD capture of a simple example. It contains 4 actors. One is fixed in space and the other three are connected to it with prismatic joints. The joints have been set up to contrain the movement of the actors around the x-axis, the y-axis and the axis (1,-1,0) respectively. Gravity has been set to 1 -1 0 to pull actors in both x and y.
- x-axis constrained actor: as expected. Stops at limit
- (1,-1,0) constrained actor: stops at same global x-value as above (not distance moved along constrained axis)
- y-axis constrained actor: moves off into infinity
OK, thanks, looking into it.
Indeed, this is a bug. It will be fixed in the next release, PhysX-3.3.3. Also, I’ll post a source code fix to the problem as soon as it becomes available. All binary SDK distros include the source to ‘PhysX Extensions’, where the problem lies.
Here is the fix. Go to ./Source/PhysXExtensions/src/ExtPrismaticJointSolverPrep.cpp, find the function:
PxU32 PrismaticJointSolverPrep(Px1DConstraint* constraints,...
if(limitEnabled && !limitIsLocked)
PxVec3 axis = cA2w.rotate(PxVec3(1.f,0,0));
PxReal ordinate = axis.dot(bOriginInA);
Change that last line to:
PxReal ordinate = bOriginInA.x;
Awesome. This fix will be added to PhysX-3.3.3.