#How to get distance along a line?

1 messages · Page 1 of 1 (latest)

marsh bronze
#

Oh I can also post some photos of what I have so far if needed.

frigid raptor
#

to get a distance between 2 objects you subtract position of first object from position of second object and then getting a magnitude of the resulting vector

#

add a subtract chip
connect 2 "get position" chips to it
connect one of get position to the gun and the other to the slide point
connect the output from the subtract chip to the "vector3 get magnitude"

haughty rover
#

Called Projection

slidee start + (slider direction * Dot(slider direction, target - slider start))

and then u clamp the dot, min being 0 will have the minimum be at the sliders start, negative will allow to go behind the sliders start, positive will allow to go infront the sliders start. And yes its in meters

there are Vector3 Project chips, but you cant clamp it like u can by doing it from scratch unless u use logic or sumn to make it work, but thats dumb

alternatively theres also inverse lerp & lerp. Value is the target, start & end for both inverse lerp & lerp are the same/straight forward

lean silo
#

@haughty rover @frigid raptor @marsh bronze

There is a new chip, Closest Point On Line, all you need is to get the closest point on the line and then get the distance from the line origin to closest point on the line, should be 2 chips

lean silo
haughty rover
lean silo
#

Closest Point On Line Segment, same thing but instead has a length definition

haughty rover
#

one those pull back things for bullet stuff

lean silo
#

Wait, does Vector Project do the same thing?, just getting the magnitude of the projected vector?

haughty rover
marsh bronze
#

um

haughty rover
haughty rover
lean silo
#

but dot doesnt return positional distance

#

it returns angular distance

marsh bronze
#

RR had a certified invention it was just a subtract and a vector3 dot

#

pretty simple

haughty rover
lean silo
#

oh i see what you mean now

#

not just vector dot

haughty rover