Jump to content
  • Advertisement
Sign in to follow this  
Lyost

object pitch and roll on a heightmap

This topic is 2648 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to determine the pitch and roll of an object (tank) on a heightmap. There's a twist that the object is larger than the cells of the heightmap, so I am using 8 control points, 4 at the corners and the other 4 aligned with the center of mass on a side (for my objects, center of mass is 0,0,0). This diagram may help (numbers are the indices into the array of the control points):
[font="Courier New"]1-7-3
| | |
4-+-5
| | |
0-6-2[/font]
Determining the height for a particular control point is easy and I've verified that part is working properly. But using those control points to determine the pitch and roll is where I'm stuck. I've computed angle of pitch between indices 6-0, 2-6, and 2-0 (same for 1, 7, and 3). For roll, it's 4-0, 1-4, and 1-0 (again, same for 3, 5, and 2). I've tried different ways of combining to get the final pitch and roll (max per side, then min; max per side then min/max magnitude; if statements creating special cases which work only in default orientation; etc). Then I scale back the computed pitch by multiplying it by |pitch| / (|pitch| + |roll|), and scale back roll by multiplying it by 1 - that value. How should the individual pitches and rolls be combined to get the final pitch and roll of the object? Or is there a better approach to this problem? I've thought about averaging the normals of the terrain the object is over, but going over a trench (or just starting over the ledge of one) should throw that off.

I've tried searching on google and this site, and can only find discussions of generating heightmaps, determining the height of a single point, or using a particular API's heightmap.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!