iKaio0991
(iKaio0991)
August 9, 2021, 5:04pm
#1
I need this part with a weld point to the player’s mouse like this:
what i got so far:
local weld = Model.firer.Weld
local hit = Mouse.hit
local rootCF = HumanoidRootPart.CFrame
local direction = (hit.p - rootCF.p).Unit
weld.C0 = CFrame.new(Vector3.new(0,0,0), direction):Inverse()
but it only works when my character is facing this stone
Not facing the stone
Facing the stone
Apologies (english isn’t my native language) & Thank u
Try:
(rootCF-rootCF.Position):Inverse()*CFrame.new(Vector3.new(0,0,0), direction)
You have to get the direction relative to the cframe of the root part for it to properly work
iKaio0991
(iKaio0991)
August 9, 2021, 6:23pm
#3
It’s working now. But reversing the CFrames order and i also added an offset
weld.C0 = CFrame.new(Vector3.new(0,0,0), direction):Inverse() * (rootCF-rootCF.Position) * CFrame.Angles(0,math.pi/2,0)
-- OR
local look = CFrame.new(Vector3.new(0,0,0), direction):Inverse()
weld.C0 = look:ToWorldSpace(rootCF - rootCF.p) * CFrame.Angles(0,math.pi/2,0)