I want to get the CFrame of the HumanoidRootPart and Mouse.hit and produce one value that changes relative to how high or low the Mouse is relative to the HumanoidRootPart.
The value needs to have a Min and Max value. I have tried some solutions and utterly failed. I can’t use the 2d mouse position if you are wondering.
All help would be appreciated.
Edit: The Mouse.Hit will always be in front of the player.
There is no code, I can’t think of a way to achieve this. There are multiple problems I have run into.
local LocalPlayer = game:GetService("Players").LocalPlayer
local Mouse = LocalPlayer:GetMouse()
local Character = script.Parent
if Mouse.Hit then
local HRPCFrame = Character.HumanoidRootPart.CFrame
local MouseCFrame = Mouse.Hit
I have been trying all types of methods on a baseplate.
Take both cframe values, get their relative offset with the camera’s cframe, and then you can grab the difference of the y heights, which would generate a value from -x to x. You cannot produce a min and max with this method alone though, so it’d be best to just utilize screen space for establishing your limits.
To be quite clear, what you’re asking for is pretty vague. I wasn’t sure whether you meant “high or low” in terms of what the screen sees, or if you meant world space Y height.
I want a stable way to measure the mouse position only on the Y axis, due to the camera being locked I can’t use screen space. I also want to avoid using the camera because the y value of the camera is not constant. Edit: I can’t quite articulate myself correctly since I can’t describe very well what I mean.