Hi there, so, after about a day of trying to figure this out, my math seems to be incorrect, or I am doing something wrong. I am creating a "Phaser" rifle, where a cone is shot from the tip of the rifle, and expands out ("I can do that part, that's easy.) The trouble is, the bottom of the cone has to expand towards whatever direction the mouse clicks. My current solution is using a position constraint, and two attachments, one at the tip of the cone and one on a part called "Tip" Either my math is wrong, or the constraint is not working as I expected.
The code to make the cone point its bottom towards the mouse
local target = conVals.Aim.Value
local oldCF = tool.WideBeam.CFrame
local upVec = target * -1
local nLook = upVec:Cross(oldCF.LookVector)
local nRigh = nLook:Cross(upVec)
local nCFra = CFrame.fromMatrix(oldCF.p, nLook,upVec,nRigh)
tool.WideBeam.CFrame = nCFra
Is my math wrong? Or is there somethign else going on? Might I add, all that ends up happening is my character moves out of control when I activate the tool.