# Pivot Joint, Singular mass matrix.

This topic is 3073 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have come across a problem in my physics engine which stems from using a Pivot style joint on an object which has infinite mass, but non infinite inertia (a trick that can be used everywhere else in the engine with no problem to model an object that is pinned perfectly to a static point in the world about it's origin rather than using a constraint) with a static reference object which is used for mouse control in this instance.

The problem is that the effective mass matrix which is required in the mathematics for the joint is singular in this case.

The mass matrix is calculated as:
$K=(m_1^{-1}+m_2^{-1})\mathbf{I}+I_1^{-1}\begin{bmatrix}y_1^2&-x_1y_1\\-x_1y_1&x_1^2\end{bmatrix}+I_2^{-1}\begin{bmatrix}y_2^2&-x_2y_2\\-x_2y_2&x_2^2\end{bmatrix}$

with m,I being mass,moment and x,y being the anchor point for the object in the joint.

which, when m1,I1,m2 are all zero, is singular and means that the pivot joint in this case either does nothing (as my mathematics deals with inverting a singular matrix by converting it to the zero matrix) or explodes when numerical inaccuracies means it is instead very near singular.

Any suggestions on how best to deal with this so that i can have the pivot style joints that rely on this mass matrix function in the given case as expected without having to simply have it as a special case where you aren't allowed to use the joint type?

##### Share on other sites
If I understand correctly you want an object pinned with infinite mass to be able to rotate around a joint. You'd have to use a different mass for this calculation than the actual infinite mass. If you're already adjusting it so it has non-infinite moment of inertia, I would suggest using the mass you used to calculate the moment of inertia. For a while I used a moment of inertia multiplier in my physics engine so I would have more control over how fast things rotated, but I don't think that would work if your mass is literally infinity. I don't see any way to get around a special case when dealing with anything infinite.

##### Share on other sites
Thankyou, that does seem to do the job as far as I can tell. I was already doing the same thing throughout most of the engine, but the cached value for imass must also be set to 0 when an object is stopped from moving, so i've had to add a second value for imass which is never modified to use for the effected constraints :P

1. 1
2. 2
3. 3
Rutin
19
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633657
• Total Posts
3013197
×