So in the image i have a blueprint witch increases the static mesh growth over time, but the growth never stops and goes on forever. So my question is how would you set a growth limit so that once it reaches that certain scale it will stop growing. Much help appreciated!
There are probably a couple of ways of doing it. Probably the easiest is to use a clamp before set the variable.
Look up “Clamp(float)”. You will be able to set the max bounds it will go.
Thanks, but i’m a little new in blueprints where do you connect the Clamp node?
You’d have to clamp the entire scale vector: Place 3 Clamp (float) nodes between your EventTick and SetActorScale3D. Split the output value of the GetActorScale3D and the input of SetActorScale3D and instead of connecting each value (x,y,z) directly, loop it through one of the Clamp nodes first. If you want, you can set different min/max values for each of the x/y/z axes.
The best way to do this is probably with a Timeline:
Creating the Timeline
- Create a Timeline in your EventGraph (not possible in functions)
- Open the Timeline
- Set the Length to the time in seconds the scaling should take
- Add a float track (by clicking on the f+ button)
- Add two keys by rightclicking in the track
- For the first key, set the time to 0 and the Value to the initial scale (presumably 1)
- For the second key, set the time to Timeline Length and the Value to the target scale
- Close the Timeline, save and compile
Playing the Timeline
- Link your IncreaseScale event to the Play execution input of the Timeline
- Link your SetActorScale3D execution input to Update
- Pass your track variable into the SetActorScale3D value input
- Save and compile your Blueprint
Your timer on BeginPlay specifies the delay with which IncreaseScale will trigger, but it will only play once. If you want anything to happen after the scaling has finished, you can hook that behavior into the Timeline’s Finished execution output.
Alternatively, you could also use a Vector track (V+ button) and use separate keys for each of the axes, then feed the resulting vector parameter directly into the SetActor3D node. That’s probably cleaner (because the output already is a vector) but if you have no experience with Timelines it could be more confusing (because you edit 3 values in one track).