Much like when you cast a ray there’s a normal property that you can get from it. Since you can get stuff like mouse CFrame and positions, is there a way to get the normal of what your mouse is hovering over?
so basically the Object it’s hovering over? if so, its mouse.Target
you can use mouse.target thats how u gets the mouses target
this is what i mean by the normal
I guess i can always cast a ray to it to get the normal, but i was wondering if there was already something for it?
There is not anything for finding the normal on Roblox to my knowledge.
1 Like
Why not simply raycast using the mouse’s UnitRay property? Then, get the normal from the RaycastResult that is returned.
2 Likes
How would that look?
local rayResult = mouse.UnitRay
local normal = rayResult.Normal
the wiki only shows getting the direction of the UnitRay from camera to mouse
print(mouse.UnitRay.Direction.magnitude) -- Always 1
im not sure how I should set this up to get the normal
No, you would use workspace:Raycast
with the unit ray of the mouse:
local unit_ray = Mouse.UnitRay
local result = workspace:Raycast(unit_ray.Origin, unit_ray.Direction * 1000)
print( result.Normal )
3 Likes