I am going to make the assumption this belongs in the building support category, as it pertains to ROBLOX’s physics engine.
Recently I have been trying to make a turret-like object that rotates on two axes. To accomplish this I figured I would use HingeConstraint to ensure a smooth rotation. This, however, created a new issue, as can be seen here.
This case arises when I try to move the TargetAngle of the horizontal axis. The vertical axis seems unable to maintain its position, though I have tried to keep it in place by increasing its maximum torque, this only makes matters worse. A similar issue arises when I attempt to move the TargetAngle of the vertical axis; namely, the horizontal and vertical rotational components oscillate and never reach their target equilibrium position.
Any suggestions to help reconcile this would be appreciated
I tend to use a single CanCollide Part that is transparent and have it welded to the rotating objects, then make the rest of the items Massless.
How much ServoMaxTorque do you have in the HingeConstraints? It should be pretty high since these forces aren’t really that strong.
Also make sure that the sections don’t have collision issues. The large part that is rotating seems to be contacting the lower section that rotates on the vertical axis.
I turned off collisions and that did not seem to solve the problem (though I will keep them off for now). Modifying the torque didn’t have much of a change but rather increased the oscillating effect
Did you make the Torque infinite? Try making it very large, but not to the point where it’s infinite.
I’ve heard cases where infinite Torque causes issues too.
Maybe try putting the Attachments of the horizontal hinge directly over top of the vertical hinge, see what that does…
I wonder if you make the Mass of each component less than the one it’s mounted to?
Meaning the very small vertical section should have more mass than the much larger horizontal section.
Better idea:
Use CFrames instead, segment the turret into several models inside the main model, then set the PrimaryPart of each model to their hinge area so they smoothly rotate from their hinges, and only when you want them to. This could be very complicated, but the reward will be well worth the effort.
My issue with tweens is that the horizontal and vertical axes would have to be tweened separately by definition. This means that the horizontally moving part would only require a rotational component, whereas the vertically moving part would require both a translational and rotational component, leaving the possibility of tweens moving out of sync. Sounds like a headache.
Besides, would it not be considered inefficient to constantly cancel a tween and make a new one?