How would I find the physical distance between 2 parts without using position? For example, if you have a large flat horizontal part, how would you calculate the distance between the floor of that part and a player jumping? How can you tell how far off of the part the player jumped?
what do u mean without using “Position”?
I have a plane like this:
I want to calculate how close it is to the shoulder joint of the arm. Using position of the plane does not work. Its like I want to find where a vector between the two that is tangent so I can find the closest distance to the plane.
u need to calculate it using magnitude minus the size of part or plus the character (usually 3)
like this
local Part1 = workspace.Part1
local Pos1 = Part1.Position
local CharPos = workspace.R15.PrimaryPart.Position
local Dist = (Vector3.new(0, Pos1.Y + Part1.Size.Y, 0) - Vector3.new(0, CharPos.Y - 3, 0)).Magnitude
i hope u get the idea, u still need to use position with magnitude, but the difference is u only calculate the Y axis and u also take in account the Y size of them, this script is an example of how far the character’s feet is away from the top of the floor surface
I showed you my application, the jumping was just an example. I need to be able to apply it in any orientation, relying on the y axis doesn’t work.
what is ur goal? is it to detect if any of the player’s part is in radius of the red zone?
Its this. I want to find the distance between the player shoulder and the part, meaning the very closest distance physically.
why not just use Magnitude?
local Distance = (Character.RightArm.Position - RedZone.Position).Magnitude – returns the distance between them
Make a runservice that raycasts under the character whenever the player jumps and there is a property that raycast will return and it is will be how far the raycast was you can then make a method that saves the highest value and there you have the value of how far the character jumped from the floor
The redzone position is very far, for the sake of what im trying to make I need the measurement as I defined, the closest distance physically from the shoulder to the red. A way to think of it is like finding where a line from the red plane to joint is perpendicular, or 90 degrees to the plane. Also, forget about the player jumping example, that was just a example.
use raycast
–awesome word because character limit–
How would I do this? How would I know where to point the raycast?
point it to the redzone position without the Y axis, meaning u create new vector with the redzone X and Z axis, but with the Y axis of ur shoulder, so it aligns and as for the direction, just use Unit to get the direction and u get the distance by doing magnitude between the shoulder and the raycast.position
if u want to be so accurate, then fire another raycast from the first raycast position as the origin, and aim it at ur shoulder, so the final raycast will return the exact surface distance between 2