Curve : How to getPoint/scrubthrough CatmullRom curve's original vector3 points?

So i have a catmul Curve made of 10 vector3 points

using getPoint and getPointAt as explained here i can get the first point at 0.1 , second point at 0.2 and so on
but these indicate the points generated by curve.getPointsand not the original vector 3 used to generate the curve

What method do i perform so that 0.1 means the first vector3 which was used to generate the curve ?

here’s a fiddle to test

the yellow dots denote the original vector3 used to make the curve and red dots are points obtained from curve.getPoints(xx)

the result i want is
when the slider reaches 0.1 the white box should overlay perfectly on the first yellow box
when the slider reaches 0.2 the white box should overlay perfectly on the second yellow box
etc

the number of points is not within my control so i cannot just pre-save the accurate values

Hi!
Check, if position of the moving object is equal, with some tolerance, to position of a static object :thinking:
Or did I get something wrong?

1 Like

hello,
I had the problem in my project while moving an object across the curve and trying to make it stop at the exact vector3 points used to make the curve, in the fiddle i recreated the issue with three.cube is so origin/position should be in the exact center

both getPoint and getPointAt do not land on the original vectors used to make the curve so was wondering if i can apply some offset or some other method so that curve.getPoint(0.1) lands exactly on the first vector

slider.oninput = function() {
  text.innerHTML = this.value
  curve.getPoint(Number(this.value), boxMesh.position)

}

Figured it out , if you have 10 vector3 points to go through, you’ll need 11 points while making the curve,
add one extra vector3 at the beginning ,

now 0 means that extra vector3 and 0.1 means first custom vector3 point

that seems to fix my issue ,
new fiddle