Original Thread from Unreal Engine Forums
Hello all! I am working on a water/river mode plugin for the Unreal Engine 4. It seems to be coming along alright. I have the base features working except for one partially works. And that one is moving a spline to adjust the path.
The problem is that as I extend move it more to the right or left, it gets weird:
I already know what the problem is:
FVector extendDir = FVector(0, width, 0); one.Vertex0.Position = v0; one.Vertex1.Position = v0 + extendDir; one.Vertex2.Position = v2; two.Vertex0.Position = one.Vertex2.Position + extendDir; two.Vertex1.Position = one.Vertex2.Position; two.Vertex2.Position = one.Vertex1.Position;
It is because I'm extending it on the Y-axis. I did it intentionally for testing purposes. Now that I know that the mesh renders alright, the next thing on my list is to get the right vector of a segment on the spline component so I can extend the mesh in that direction. That way, it will never get squished like that and the width of the mesh will stay constant throughout the whole thing. How would I do this? Is it possible? I've been trying to do this all day. And I cannot use the point's rotation because it has not been rotated, I just moved it. Is there a way to calculate this using the first point and connected point or something? Thanks!