How to stop spline mesh from stretching?

I’m following Zack Parrish’s tutorial on road building using splines:

link text

How do I stop the spline mesh from stretching? The road and guard rails become stretched and distorted when the spline points are too far from each other. Right now, I can control this by manually positioning the spline points at distances that minimize the stretching. However, is there a way to do this automatically? Is there a way so that the mesh doesn’t stretch at all, like tiling the mesh along the spline? Or is there a way to set the maximum distance that each spline point can move from each other, thereby eliminating the stretching effect on the mesh?

I asked this a year ago: How To Tile Mesh Along Spline Component Evenly? - Blueprint - Unreal Engine Forums

No one ever answered it. I still haven’t found an answer. ;(

DaGreat and Allen,

If you are looking for a switch or property to set, you will not find it, as it doesn’t exist. The only way to do it, is to get the size of the static mesh (presumably the X axis), then divide that into the spline length, to get the number of control points on the spline to generate. The remainder you can deal with as you wish, by either, adjusting the last control point to make it integral, or spreading the remainder out amongst the other segments, or just dropping the remainder of course.

Then get all the spline control points on the spline, and start getting the new spline control points locations, by using the GetLocationAtDistance in a loop. When you are done with the loop, be sure to delete all the spline control points, then using the generated locations that you made for the new points, now create the control points at those locations. This is how I did it for my product .

.

Thank you. This is the route I was going to take, but I never figured out how to get the X height of an actor. Is it “getActorBounds()” or is there another way? Thanks again!

use GetComponentBounds() as your dealing with a static mesh

Ryan solved this perfectly here;

2 Likes