Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Turret Weld, facing opposite from the mouse?

Asked by 9 years ago

I need help with getting the weld to face the direction that the mouse is pointing to, so far the turret is turning, though it's facing the opposite side that the mouse is pointing. This is what I have so far;

local offset = (Turret.Connector.Position - Mouse.Hit.p)
local direction = offset.Unit
local angle = math.atan2(direction.Z, direction.X) + math.pi
local angle2 = math.asin(direction.Y)
VerticalValue.Value.Value.C0 = CFrame.new(VerticalValue.Value.Value.C0.p) * CFrame.Angles(0, direction.X, 0)
0
If it works perfectly, but is facing the wrong way, just try changing some things to negative. Perci1 4988 — 9y
0
I attempted to do so though it still had faults, I instead replaced it with a hinge and it's working perfectly. Thanks though HRMKingCharlesIII 0 — 9y
0
I made a script to make a player's arms point towards the mouse using the manipulation of their arm welds.. maybe you could implement it into this code somehow? It's in my models. Goulstem 8144 — 9y

Answer this question