math & physics
i am stuck with thinking how to make the .x player animation move up a terrain that is not flat but has bumps and hills , would it be something todo with the vertexbuffer and the player translation current postion?
If your terrain is stored as a heightfield, then what you need to do is:
- use the player's x and y coordinates to find the grid square of terrain they are currently in
- look up the heights of the four corners of that grid square in the heightfield
- use bilinear interpolation to calculate the height of the terrain at the player's exact x and y coordinates
- translate the player so that the feet are at that height (z).
Later on you'll probably want to implement some physics so that the player can't climb up slopes that are too steep. But this should get you started.