BGP Week 4: Spline Level Generation – From cubes to modeled meshes
|
This week I continued the work on the level generation. Our artist had finished most of the track mesh, I decided to try implementing it in the current system. I already knew from the start that I would have to modify what I already had; the previous system relied on hardcoded vertex indices, and the cubes I played around with earlier only had 24 vertices in total. The new mesh had somewhere around 400 vertices, which Unity then further increased to 848 vertices when importing it (from what I could tell, the reason Unity does this is for example if one vertex is used in several positions in the UV, and a bunch of other reasons.) So I needed some way of finding out which vertices were located on which edge of the mesh. Since the mesh is completely symmetrical, I had a hum of what I could do: in theory, I should have been able to just loop through the vertices, and find which vertices had the highest and lowest value in what (after some trial and error) ended up being the X axis, for the front and back of the mesh, respectively. Out of these, I should be able to use the remaining two axis values to find which vertices should connect to each other, and pair those up. This actually worked, to some extent. It would find the vertices of the front and the back, like expected. If I increased the value of one axis, the vertices would move like expected. If I tried to create pairs of which indices to connect, all hell broke loose. Vertices would connect to the wrong side of the other object, or even to itself. Sometimes only half of the mesh would get paired up. More bad stuff happened which I have repressed. Safe to say, it didn’t work. Therefore, after spending two hours with my tutor, as well as more or less the whole Tuesday trying to debug it to little success, I rewrote the connect function. Most of it stayed exactly the same, except that I split the if-clause comparing the Y and Z axes. Suddenly everything worked as expected. Mostly. Except now, it wouldn’t find all of the vertices in the front and back, missing 18 (or so) on both the far left and right sides of the mesh, as well as messing up the texture (more than just squishing or stretching it). At this point, I’m sort of conflicted on what to do. I passed the third week of constantly working on this, with progress not even being close to what it should be (in my opinion), and in order for this to be beneficial to the project, the first version should have been finished by now. I’m thinking of prioritizing the other features of the game instead, and perhaps returning to this once most other things are done, since it’s also what I planned to write my final report on. I’ll discuss this with my group on Monday. Also, sorry for no images or source code. I don’t really have access to the project on my home computer (since Sourcetree refuses to cooperate with Windows 10 😐 ), and I kinda forgot to commit my code… I’ll try to edit this later if I remember to
|