# Extracting the distance from an object

So i wanna have a system were if the raycast detects the object it extracts its position or its distance, Im mainly looking for its distance. Note there will be multiple raycast so it must be a universal system

use the distance formula: d = sqrt((y2 - y1)^2+(x2 - x1)^2)

Example, Im unsure how to use expressions?

My bad i forgot about something. If a raycast hits something it should output the distance from it.

1 Like

you could shoot the raycast then if it hits send the angle to all (of the hit object) then subtract 360 from the angle and shoot if it hits you know which both objects are (to use the distance formula)

Ill need an example, im more of a visual type of guy lol

one sec ill have to make one

uhm i have a “detect if something is close enough” code in my Flowlab Game Creator - A Guy in the Wild game

it’s really complicated but it works… (if this helps)

You do not need this to find distance. You can literally do it in a single expression.

i was just putting it in case it helped. usually things with distance boil down to am i close enough so

Well i merged ideas together and it works!

I have a distance bundle in my library: