Right now I want to know how to get the mouse position at the same y coordinate as the humanoid root part of the player.
Here’s what I’m doing currently:
-- create hitbox for ray
local hitBox = mouseHitBox:Clone() -- has a size of like (500,1,500) so the mouse it hovering over it
hitBox.Position = rootPart.Position
hitBox.Parent = workspace
-- create ray
mouseParams.FilterDescendantsInstances = {hitBox} -- whitelist
local mouseRay = workspace:Raycast(mouse.UnitRay.Origin, mouse.UnitRay.Direction * 300, mouseParams)
https://gyazo.com/e631fc56095802d0fe36f636dde12048
In the video, the character is looking at the mouse position, ignore the mouse.Hit position from the part behind the player, and continuing the direction until it reaches the invisible hitbox.
If I were to just use mouse.Hit, the character would be looking at the part.
Although this works, I want to know a different way to do this without creating a new part.