About 'Adjusting Radius With A Curve'!

  • What is a curve?
  • Accessing a curve from C++.
  • Setting the radius from speed.

(Unique Video Reference: 14_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’d like to make a suggestion about this lecture:

The player already has a maximum walking speed, which provides a definitive x axis limit for the curve. So in order to keep things scalable and for the ease of modification along the course of development, why not do it like this?:

Define the curve as a unit curve with all axes ranging from 0 to 1.

Define a variable called MaxSpeed of type Float, with the default value that you used in the curve (1000, I think)

In the BeginPlay function, get the character movement component and assign MaxSpeed variable the maximum speed the player character has.

UCharacterMovementComponent* CMC = GetCharacterMovement();
if (CMC) MaxSpeed = CMC->GetMaxSpeed();

So in the BlinkerUpdate function you can get a consistent blinker behaviour regardless of what the maximum speed is and without the need of updating the curve when the project defaults are changed:

if (BlinkerCurve) {
	float Vel = GetVelocity().Size();
	BlinkerMatDyn->SetScalarParameterValue("radius", BlinkerCurve->GetFloatValue(Vel / MaxSpeed));

That seems like a sensible thing to do.