Is there a way to generate a curve square and then drag the curve in the 2D on the screen in that XV?
I basically want randomly construct some terrain using curve and then want to draw it. Hoping that I can use that curve to detect the collision with the land.
It looks like what you want is the 2D equation of the altitude map. I would like to avoid making a true "curve" and be the approximate one with the line line segment.
So basically you will have a list of arrays or numbers that show the height of your area equally at equal distances (horizontally) points When you need the height between two points, then you just repeat between the two.
To generate it - You can set some points randomly, and then interpolation for some kind of smooth rest (what exactly are you doing Depending on the curve depends on it.)
To render it you can then only use one triangle strip at each point of your height-map There will be two corners attached together - one at the bottom of the screen, the other At the height of that point in the height-map
Detecting to collision - The easiest way is that your objects are a single point (it seems that you are creating an artillery game like a scorched earth) - Just get X position of your object, get the position of the y in your locality, on that x position, if your position's Y position is below the terrain, then set it so that it is on the surface of the area.
This is some kind of guide, anyway :)
Comments
Post a Comment