- Home /
Help needed with creating custom 3D Slider Joint
Hello,
I've been programming my game engine and I'm almost done now. I've added "Multi-Rigidbody object support", which basically lets the game handle multiple rigidbodies linked with joints (not that one GameObject has more Rigidbodies, it's just called like that, I don't think I'll go into detail here about how the game works).
Anyway, I stumbled upon a problem that I kind of expected, but it became much larger than I anticipated: I had to use ConfigurableJoints to simulate pistons, and although the connectedRigidbody movement can be locked in two directions and limited in the third, there was always the issue that the joints were very unstable. The piston sometimes didn't even extend until the value was at about 0.5, and when it did, it sometimes made the entire object fling itself aside a little. Basically, not something you'd want a piston to do.
So I decided that probably the best solution would be to create my own joint, because no matter how hard I tried, the ConfigurableJoint was just too unstable, and from a Google search, no one had created a 3D Slider joint before (at least not for free).
But since I'm quite inexperienced, this is very tough to make (I'm a Unity developer for less than 3 months). Snapping the connectedRigidbody onto an axis won't quite do it, as I need forces to be applied bi-directionally, like it should. But when I tried to keep the object on the axis using forces, it just creates an endless oscillation and I don't know how to make damping (or almost anything to make this work).
Does anyone here have some experience to share with this? I would very much appreciate it!
Thanks!
I basically need a more stable joint that can restrict a Rigidbody to a single axis (in relation to another Rigidbody) like when you lock two axes using a ConfigurableJoint, but the ConfigurableJoint is too unstable for my needs. I thought of creating my own joint, but I don't know how.