« first day  last day (14 days later) » 

12:51 AM
I'd use a terrain with only one bump on it to debug first (i.e. use a flat surface with only one vertex sticking up, causing only the adjacent triangles to be angled). If that doesn't help, then I'd use a terrain with only a single tile (i.e. a 2x2 height map) and get that working first. This will allow you to eliminate any problems with offset calculations, etc.
 
1:15 AM
I'm thinking it might be something to do with how I'm getting the offsets and that, I will see what I can do :) does the code for finding the y coordinate look ok though?
 
1:27 AM
It does to me. That's why I suggested checking the offset calculations. Also make sure you're picking the right triangle, e.g. using some known values.
If a wrong tile and/or wrong triangle is picked, then the y calculation will extrapolate to the point from the triangle you picked. So the y value will be as if the wrong triangle was bigger and contained your point. If you can, visually check if the y value matches the extension of a nearby triangle, which would tell you that you've picked the wrong triangle.
Also check to make sure the * operator does what you think it does, i.e. a cross product.
 
I made a new height map with random white points and it would seem that the grass I'm trying to place is going up slightly to the side of each hill so I will fiddle with the offsets, getting closer now though I think :)
 
1:45 AM
Good. If it's a constant offset, you may be one tile off, e.g. using the heights from the neighbour tile. I don't know how you convert x and z to tile indices; check how your round the numbers; if you do any float to integer conversion, remember that the conversion will truncate (chop off) the fractional part, which is the equivalent of floor(x) for x >= 0 and ceil(x) for x < 0.
 
I'm not too sure what's going on, the points which lay exactly on one of the terrains vertices is given the correct y position but it seems that the two others in the same triangle are being given the same height
 
Have you tried a 1x1 terrain (2x2 height map)?
i.e. just a single tile with two triangles
 
The crossing! That was the problem, I had presumed that * did a cross product but I just changed it to use the build in cross function and the grass seems properly grounded :D Thanks for all the help!
 
Good thing I asked about the * operator. Glad to have solved the problem.
 

« first day  last day (14 days later) »