Hey all! Having an odd issue that I have been banging my head over for the last 24 hours. I have been trying to make spline meshes in real time, and I am almost there, but I keep having an issue where only one new mesh is drawn, no matter how many points I add.
In my world I have 2 spline points already made:
When I call “Draw All Spline Meshes”, the mesh shows up as expected:
Then when I call “Add New Spline Point”, then call “Draw All Spline Meshes” again, it shows as expected:
I saw that too, this code originated from a tutorial, but the tutorial was using it in Construction Script. I changed it like so and now it will draw the mesh, but the mesh is messed up.
If i make the function the same way as that, I get the same behavior. It will only add 1 mesh.
Also, if I eject from editor and move a point manually, then re-posses and call “Draw All Spline Meshes”, the mesh is drawn correctly… I’m so confused.
Notices here, he subtracts 2 from the total points of the spline: that is to not go out of bounds of the array.
If you have 4 points and you’re accessing 2 at a time → you need to loop 1 less time to not go out of bounds. So from 4 points in the spline (0 → 3), you want to loop 3 times, not 4, like this:
It draws the initial meshes, and one addition mesh added during runtime, but not 2+. All subsequent meshes are not generated unless I move them manually in editor, then call “Draw All Spline Meshes” again. So it is the same issue as my first post.
Odd… If I move all of the points 10 units on the X axis, then the meshes are drawn correctly… But obviously they are no longer in the correct location…
Added this:
And now I get this. Now to figure out why moving all points and redrawing meshes fixes it… Seems like it forgets the other points locations somehow and running Set Location At Spawn Point refreshes it? But even if I do that and don’t actually move anything it doesn’t work. The points have to be moved for it to work.
Edit: Thinking this may actually be an engine bug… Anyone have any other advice here? The only way I can generate the meshes is if I move the points by some arbitrary amount before generating the meshes. If I don’t move them, they do not spawn…
Edit 2: @Everynone I see you have helped a few fellows before with spline meshes. Can you give me some advice?
Edit 3: Just figured out that the subsequent meshes are being drawn, but they are being drawn like this:
I took new function pictures if it helps make it easier to understand:
Edit: So it seems like there is nothing wrong with my code, I think. The issue has something to do with generating the mesh directly up. If I generate them on the X axis, it works exactly as I expect without moving any points.
Yes I have seen that. I am guessing “render state” isn’t what I was thinking it was then. I thought it was the way the mesh is actually rendered in the world. I thought running Update Mesh would update its appearance. Guess I will just redraw them then. Thanks.
Actually I will just redraw the mesh between the points that changed.