Hello, so, I want to make an effect like this, but I have no idea how to do it
External Media
3 Likes
What I do is:
local Camera = workspace.CurrentCamera
local UIS = game:GetService("UserInputService")
local function get_mouse_pos_in_percentage()
local mp = (UIS:GetMouseLocation()/Camera.ViewPortsize) - Vector2.one*0.5
return mp
end
What this does is makes the mouse’s top-left corner (-1,-1), middle (0,0) and bottom-right (1,1) and then you can do:
local mp = get_mouse_pos_in_percentage()
local maxangle = 10
Camera.CFrame = CFrame.Angles(math.rad(mp.X*maxangle),math.rad(mp.X*maxangle),0)
and set the above code in a loop.
1 Like
Where can I learn to do this type of calculation? I don’t want to have to resort to coming here every time I need to do a calculation
I don’t really know. Its quite simple honestly. Just google stuff.
Yeah but, I would never know how to do that. I wouldn’t know that you need to calculate the screen or anything.
Well thats a bummer. Anyways if you need maths help then this site (Devforum) is perfect for you, because most of the maths here is out of my brain.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.