About 'Using A USplineComponent'!

  • Adding to a spline component.
  • How the component works.
  • Previewing the spline in debug mode.
  • Setting the spline control points in C++.

(Unique Video Reference: 18_AE_VR2)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!

I’m not sure if this is discussed in later lectures, but for me (on the Oculus Rift) the spline follows the debug trace if the trace collides with the floor, but if it doesn’t the spline rotates with my touch controller. What would be the best way to keep the spline path from rotating?

Learning quite a bit here. A couple of things I have done differently really focus on performance optimizations. I notice that you create and pass a lot of data between functions such as the Spline Point TArray. I have created class variables to hold any reused data (such as the FPredictProjectilePathResult). That way, I am not having to pass a lot of data/pointers per-frame, which may get ugly in more visually complicated games.

Other than some tweaks like that, some very solid stuff so far.

My solution was vastly simpler:

	TeleportPath->ClearSplinePoints();
	for (FPredictProjectilePathPointData Step : PredictResult.PathData)
	{
		TeleportPath->AddSplineWorldPoint(Step.Location);
	}

Before I watched the rest of the lecture I wasn’t concerned with updating or not updating the spline so arguably I have a performance hit here, but in practice it wasn’t noticeable. But, you don’t need to faff about with transforms and can just add a new point in world space with the above method. It also sets up the points with the correct curve type so that’s an added simplification.

You can have the best of both worlds, a simpler solution without the performance hit:

TeleportPath->ClearSplinePoints(false);
for (FVector Point : Path)
{
	TeleportPath->AddSplinePoint(Point, ESplineCoordinateSpace::World, false);
}
TeleportPath->UpdateSpline();
1 Like

Privacy & Terms