I have a plane, and i made a copilot that is able to control a turret which works really well. However when the plane moves the turret gets messed up:
robloxapp-20211215-1419355.wmv (4.1 MB)
its like when the jet was rotated the opposite way, the turret weld does not work with the weld, behaves like the jet was still in the original position before the weld moved. How to fix this?
I was thinking I could somehow i could get the offset before the jet is rotated, and then apply this back to the turret, but dont know how i would do this
Edit: I found a solution to this by multiplying this cframe by the rotational cframe (where the turret should point):
CFrame.Angles(0, math.rad(45 * (primaryPart.Orientation.Y + 90)), 0)
however when the jet is rotated on other axis like x and z it gets a bit whack