Inconsistencies in Curve3D

Godot Version

4.6.1

Question

I have a question regarding some potential inconsistencies or maybe they are straight up bugs about Curve3D?

The first thing about Curve3D is the bake_interval value and it is defined as:
The distance in meters between two adjacent cached points. Changing it forces the cache to be recomputed the next time the get_baked_points() or get_baked_length() function is called. The smaller the distance, the more points in the cache and the more memory it will consume, so use with care.
However this is either very inconsistent or just straight up not true, the cached points can vary a lot in their distance between each other, for example I had my bake_interval set to 0.2 and when measuring distance between points with a simple script like this:

var pts := testcurve.get_baked_points()
var previous_pt := Vector3(0, 0, 0)

for pt in pts:
    var dist = pt.distance_to(previous_pt)
    previous_pt = pt
    print(dist)

These are the results I would typically get:

0.0
0.36399009823799
0.34603890776634
0.33283317089081
0.32340303063393
0.31668502092361
0.31161689758301
0.30721321702003
0.30261081457138
0.29708623886108
0.29005479812622
0.28106015920639
0.26976302266121
0.49500450491905
0.41864815354347

As you can see quite a wide range of values when the bake interval is just 0.2
You can even see the effect visually lacking consistency.

Now are these working as intended and I am missing something here, or is this some kind of a bug? Sampling any other baked value like sample_baked() works flawlessly and as expected.

1 Like

It’s not exactly a bug but the documentation is not correct, I think.

You can read the discussion here to understand it better.

1 Like