diff --git a/Source/Engine/Level/Actors/Spline.cpp b/Source/Engine/Level/Actors/Spline.cpp
index 9f47aa06e..3bb08b65c 100644
--- a/Source/Engine/Level/Actors/Spline.cpp
+++ b/Source/Engine/Level/Actors/Spline.cpp
@@ -231,9 +231,41 @@ void Spline::ClearSpline()
UpdateSpline();
}
+void Spline::SetSplinePoint(int32 index, const Vector3& point, bool updateSpline)
+{
+ CHECK(index >= 0 && index < GetSplinePointsCount());
+ Curve[index].Value.Translation = _transform.WorldToLocal(point);
+ if (updateSpline)
+ UpdateSpline();
+}
+
+void Spline::SetSplineLocalPoint(int32 index, const Vector3& point, bool updateSpline)
+{
+ CHECK(index >= 0 && index < GetSplinePointsCount());
+ Curve[index].Value.Translation = point;
+ if (updateSpline)
+ UpdateSpline();
+}
+
+void Spline::SetSplineTransform(int32 index, const Transform& point, bool updateSpline)
+{
+ CHECK(index >= 0 && index < GetSplinePointsCount());
+ Curve[index].Value = _transform.WorldToLocal(point);
+ if (updateSpline)
+ UpdateSpline();
+}
+
+void Spline::SetSplineLocalTransform(int32 index, const Transform& point, bool updateSpline)
+{
+ CHECK(index >= 0 && index < GetSplinePointsCount());
+ Curve[index].Value = point;
+ if (updateSpline)
+ UpdateSpline();
+}
+
void Spline::AddSplinePoint(const Vector3& point, bool updateSpline)
{
- const Keyframe k(Curve.IsEmpty() ? 0.0f : Curve.GetKeyframes().Last().Time + 1.0f, Transform(point));
+ const Keyframe k(Curve.IsEmpty() ? 0.0f : Curve.GetKeyframes().Last().Time + 1.0f, Transform(_transform.WorldToLocal(point)));
Curve.GetKeyframes().Add(k);
if (updateSpline)
UpdateSpline();
@@ -241,7 +273,7 @@ void Spline::AddSplinePoint(const Vector3& point, bool updateSpline)
void Spline::AddSplineLocalPoint(const Vector3& point, bool updateSpline)
{
- const Keyframe k(Curve.IsEmpty() ? 0.0f : Curve.GetKeyframes().Last().Time + 1.0f, Transform(_transform.WorldToLocal(point)));
+ const Keyframe k(Curve.IsEmpty() ? 0.0f : Curve.GetKeyframes().Last().Time + 1.0f, Transform(point));
Curve.GetKeyframes().Add(k);
if (updateSpline)
UpdateSpline();
diff --git a/Source/Engine/Level/Actors/Spline.h b/Source/Engine/Level/Actors/Spline.h
index cc4226414..76f1eddab 100644
--- a/Source/Engine/Level/Actors/Spline.h
+++ b/Source/Engine/Level/Actors/Spline.h
@@ -198,6 +198,38 @@ public:
///
API_FUNCTION() void ClearSpline();
+ ///
+ /// Sets the spline curve at the given index (world-space).
+ ///
+ /// The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().
+ /// The location of the point to set (world-space).
+ /// True if update spline after adding the point, otherwise false.
+ API_FUNCTION() void SetSplinePoint(int32 index, const Vector3& point, bool updateSpline = true);
+
+ ///
+ /// Sets the spline curve at the given index (local-space).
+ ///
+ /// The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().
+ /// The location of the point to set (local-space).
+ /// True if update spline after adding the point, otherwise false.
+ API_FUNCTION() void SetSplineLocalPoint(int32 index, const Vector3& point, bool updateSpline = true);
+
+ ///
+ /// Sets the spline curve at the given index (world-space).
+ ///
+ /// The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().
+ /// The location of the point to set (world-space).
+ /// True if update spline after adding the point, otherwise false.
+ API_FUNCTION() void SetSplineTransform(int32 index, const Transform& point, bool updateSpline = true);
+
+ ///
+ /// Sets the spline curve at the given index (local-space).
+ ///
+ /// The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().
+ /// The location of the point to set (local-space).
+ /// True if update spline after adding the point, otherwise false.
+ API_FUNCTION() void SetSplineLocalTransform(int32 index, const Transform& point, bool updateSpline = true);
+
///
/// Adds the point to the spline curve (at the end).
///