Scaling a Plane (StaticMeshActor) in the X Axis with a Slider

Hello there!

I am completely new to using Unreal Engine 4; please bear with me if I am not familiar with how this works quite yet, as I am learning some new skills. I used to do some projects a few years before with Unity, but for this university project I’m working on as part of finishing my bachelor’s degree, I chose UE4 because it delivers photorealism and offers a nice opportunity for me to practice C++ programming.

Anyway, I’m building, on an agile basis, a scenario generator for a student design team at my university on autonomous vehicles.

I have a simple plane here, with no textures applied to it, that I would like to scale while the application is running.

To start out, I want to use a slider placed at the top left corner to adjust the length of this “basic, transparent road.” This is done by adjusting the scale of the plane on the X axis; for now, just between 10 to 100 meters. The UI blueprint looks like this:

Right now, I need to add an OnValueChanged event listener so that when I move the slider back and forth from left to right, it sets a new scale value for the X axis of the plane. What I don’t know yet are what nodes I need to use in order to get the plane’s current scale, as a vector, set the X axis independently, then reassign it back to the actor. This is my blueprint so far:

All it does is it only takes the value of the slider and transforms it to a value between 10 to 100.

Do you know what I need to do next? Any helpful documentation and lessons I could perhaps check out? UE4 looks much more complicated than Unity, but it really helps me with my skills as I’m new and keen to this.

Here’s the most basic implementation:

The widget with the slider calls its own Event Dispatcher and sends Slider Value to any object that will register with this event:

In the Level Blueprint, I manually dragged & dropped a reference to the Floor from World Outliner:

Begin Play adds the widget to the viewport and binds the widget dispatcher call to an event in the Level Blueprint:

Image from Gyazo

The rest is getting the scale from the Floor reference and setting it back to what the Map Range node spits out. It scales only one way here because the pivot in the blank template I used it set up like that:

Image from Gyazo

If something does not add up, do tell.

tip: you can right click pins and split them (break them into components) - like the vector of Get Actor Scale 3D node above.

Ooh, sweet. Let me try that and get back to you, because I think this is what I need. Scaling one way instead of both ways is definitely fine for now. Thanks so far!

Got it! I was wrong; it does scale in both ways, because I’m scaling the plane itself where the pivot is placed in the exact center of the plane, and not on one end of a road. I think to place the pivot there, I need to nest the road into an empty object and set the position of the road itself respectively. (Unfortunately, that does require changing the blueprint a print so that I am scaling the parent object itself and not the road mesh itself.)

Thank you so much!