What I want to do is to force my character model to always view towards the mouse on the screen (not the location of the mouse in 3D space, using Mouse.Hit.p).
I've got the location of the mouse by using the origin point of Camera:ScreenPointToRay() but now I do not know how to transform the R15's Waist Motor6D to look itself towards the mouse. The character is guaranteed to force the player's screen. It is also a standard rig.
This is my current failed implementation.
function menu:LatchTorsoToMouse() local Camera = workspace.CurrentCamera local Mouse = Player:GetMouse() local Stepped = RN.Stepped:Connect(function() print('Stepped began.') if Model.Parent == nil then return end local ScreenPoint = Camera:ScreenPointToRay(Mouse.X, Mouse.Y, 1) local OriginPoint = ScreenPoint.Origin local Waist = Model.UpperTorso.Waist Waist.Transform = CFrame.new(Waist.Transform.p, OriginPoint) end) return Stepped end
It might be because of object space vs. world space or whatnot but I am also not too sure. How do I go about fixing this?