Merge pull request #66954 from Nidjo123/sample-baked-up-vector
Handle last baked vector index early
This commit is contained in:
commit
70d8895396
1 changed files with 4 additions and 4 deletions
|
|
@ -1667,6 +1667,10 @@ Vector3 Curve3D::sample_baked_up_vector(real_t p_offset, bool p_apply_tilt) cons
|
|||
idx = (end + start) / 2;
|
||||
}
|
||||
|
||||
if (idx == count - 1) {
|
||||
return p_apply_tilt ? r[idx].rotated((rp[idx] - rp[idx - 1]).normalized(), rt[idx]) : r[idx];
|
||||
}
|
||||
|
||||
real_t offset_begin = baked_dist_cache[idx];
|
||||
real_t offset_end = baked_dist_cache[idx + 1];
|
||||
|
||||
|
|
@ -1675,10 +1679,6 @@ Vector3 Curve3D::sample_baked_up_vector(real_t p_offset, bool p_apply_tilt) cons
|
|||
|
||||
real_t frac = (p_offset - offset_begin) / idx_interval;
|
||||
|
||||
if (idx == count - 1) {
|
||||
return p_apply_tilt ? r[idx].rotated((rp[idx] - rp[idx - 1]).normalized(), rt[idx]) : r[idx];
|
||||
}
|
||||
|
||||
Vector3 forward = (rp[idx + 1] - rp[idx]).normalized();
|
||||
Vector3 up = r[idx];
|
||||
Vector3 up1 = r[idx + 1];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue