I will try tommorow, and I will tell if it worked. Because I need to go rightnow.
Alright, I can provide you more information and resources then
I don’t really want to use BodyGyro
or any of that, because I need to rig the model. I am trying to make a script that rigs everything automatically. I would rather to do it with CFrame
. My entire tank is based on CFrame
except for pushing it forward and backwards.
It doesn’t work, it just throws turret into mouse position.
You can subtract the mouse CFrame and the turret CFrame to get aim. Issue is it would move the entire turret. Im not experienced enough with CFrames to know how to only make it rotate on the Y Axis only. You could start off by using CFrame:ToWorldSpace()
so it always rotates on the Y-Axis even at a slant, and maybe you could find a way to rotate it on the Y Axis exclusivly. I‘ll try some methods, I‘ll update if I find anything relevant!
TurretController.C0 = CFrame.new(TurretController.C0.p,
Vector3.new(Mouse.Hit.p.X, TurretController.C0.LookVector.Y, Mouse.Hit.p.Z)
)
I did this, but it doesn’t rotate always, I am not sure why.
Bumping this post because I still don’t know why it doesn’t always turn to my mouse position, I think camera is effecting it but idk why.
How about CylindricalConstraint?
CylindricalConstraint.TargetAngle = Mouse.Hit.LookVector.Y
I am not sure on how to get number from Mouse Position to do that.
Sorry for the bump, but now I made a resource to help you out:
There are a lot of things you have to do like CFrame:Inversing() the part 0 in order to obtain the correct rotation relative to the world which this module does for you so go check it out.