Hello, I have recently built a gun in modo that uses hydraulics to position itself and imported it into Unity. Picture below:
Right now the hydraulics DO work using pivot points, capsule colliders, and box colliders (it uses the physics engine). But the problem is, after I mounted it on the ridgidbody car, the hydraulics will not stay mounted!! The only thing that makes it stay mounted is if I make every piece a kinematic rigidbody, which causes the hydraulics to stop working (as it needs the physics engine to work).
Does anyone know how to make the hydraulics stay mounted on the car AND work (meaning that the hydraulics look like it is pushing the barrel)?!
Have you tried the variety of available joints? Fixed Joint allows you to stick two rigidbodies together.
Question: Is it important that the gun moves with actual physics? Seems like a lot of trouble for orienting a turret.
There’s a couple of gotchas that pop up in my mind. Using physics on such a tiny and precise scale can be unstable (especially when tightly linked with a high-speed vehicle). I’m not sure you can really model hydraulic pistons with rigidbodies like that; you might have to build them with custom code.
Thanks, I’ll try to use the fixed joint again and see if it works. If anyone could be so kind however to provide me with code to actually move the pistons, that would be great.
Until then, I seem to be stuck with physics based pistons