Download

Dynamically change actor size with tick function

So I’m working on a school project and I need to just add some sort of functionality to my project, it can be anything I want it seems. One of the suggestions was to have an actor change size. I wanted to write some code in the tick function that has the actor increase in size until it reaches a certain size, then decrease in size until it reaches another size. I don’t need the entire code, I know how to check the sizes and whatnot (at least I have a janky idea at worst), I just don’t know what the specific code is to alter the actor’s size itself. I assume the simplest way is to have the entire thing scale together, rather than just one side or something. Any suggestions on how to scale up the actor in the tick function?

Hint: AActor | Unreal Engine Documentation

The code itself to make it larger/smaller in a linear fasion is just super basic math and non specific to ue4.

Something like this:

  • FVector currentScale = GetActorScale3D()
  • FVector newScale = currentScale * 1.01f * GetWorld()->GetDeltaSeconds()
  • SetActorScale3D(newScale);