MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / UpdateSpline

Method UpdateSpline

Source/Engine/Level/Actors/Spline.cpp:447–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445}
446
447void Spline::UpdateSpline()
448{
449 auto& keyframes = Curve.GetKeyframes();
450 const int32 count = keyframes.Count();
451
452 // Always keep last point in the loop
453 if (_loop && count > 1)
454 {
455 auto& first = keyframes[0];
456 auto& last = keyframes[count - 1];
457 last.Value = first.Value;
458 last.TangentIn = first.TangentIn;
459 last.TangentOut = first.TangentOut;
460 }
461
462 // Update bounds
463 _localBounds = BoundingBox(count != 0 ? keyframes[0].Value.Translation : Vector3::Zero);
464 for (int32 i = 1; i < count; i++)
465 _localBounds.Merge(keyframes[i].Value.Translation);
466 Matrix world;
467 GetLocalToWorldMatrix(world);
468 BoundingBox::Transform(_localBounds, world, _box);
469 BoundingSphere::FromBox(_box, _sphere);
470
471 SplineUpdated();
472}
473
474#if !COMPILE_WITHOUT_CSHARP
475

Callers 8

TickMethod · 0.80
AddSplinePointMethod · 0.80
OnSetTangentsLinearMethod · 0.80
OnSetTangentsSmoothMethod · 0.80
SetKeyframeLinearMethod · 0.80
SetTangentSmoothInMethod · 0.80
SetTangentSmoothOutMethod · 0.80
SetPointSmoothMethod · 0.80

Calls 5

BoundingBoxClass · 0.50
TransformClass · 0.50
GetKeyframesMethod · 0.45
CountMethod · 0.45
MergeMethod · 0.45

Tested by

no test coverage detected