|Attention||Topic was automatically imported from the old Question2Answer platform.|
I’ve figured out how
How to get the direction at this closest point?
Short answer is
(closest_point - current_point).normalize() … but that is a guess. Please add some code in your question (edit)
clemens.tolboom | 2021-07-25 16:05
the code lools similar to this:
var curve := Curve3D() var closest_point = curve.get_closest_point( point_somewhere )
I don’t have a current_point on the curve.
MikeMikeMike | 2021-07-25 17:45
I exactly don’t know what you want, but i think you need to use curve’s
get_point_position(point_index) to get position, and then simply calculate direction vector as CLEMENS.TOLBOOM said:
var curve := Curve3D() var direction_vector = (curve.get_closest_point( point_somewhere ) - curve.get_point_position(any_point_number)).normalize()
Falcon | 2021-07-25 19:05
from where do I get your
any_point_number value, and does this make sense?
MikeMikeMike | 2021-07-25 19:54
hi clemens and Falcon,
I have changed my code from
get_closest_offset, which seams to work. Then with
interpolate_baked I can calculate the direction like this:
var curve := Curve3D() var offset = curve.get_closest_offset( point_somewhere ) var point_1 = curve.interpolate_baked( offset, true ) var point_2 = curve.interpolate_baked( offset + 0.01, true ) var direction : Vector3 = ( point_2 - point_1 ).normalized()
Thank you again
MikeMikeMike | 2021-07-25 20:13