Skip to content

Collision Series 5 Heightmap Collision with Normals

Simon Jackson edited this page Sep 2, 2016 · 8 revisions

#Collision Series 5: Heightmap Collision with Normals#

Area Games: 3D Graphics, Games: Collision Submitted 1/10/2008 Code Sample


Description:

This sample demonstrates how to use information about a heightmap's vertex normals to follow the contour of the terrain.

Sample Overview

The [Collision Series 4: Collision with a Heightmap](https://github.com/DDReaper/XNAGameStudio/wiki/Collision Series 4 Collision with a Heightmap) sample demonstrated how to make a sphere roll around on a heightmap. One way to improve this is by orienting the object to follow the contour of the terrain. This sample provides a more believable effect for objects such as vehicles, which won't always be pointing the same way up as they move around.

This sample demonstrates how to do this by moving a tank around on a heightmap. The code involved is similar to the [Collision Series 4: Collision with a Heightmap](https://github.com/DDReaper/XNAGameStudio/wiki/Collision Series 4 Collision with a Heightmap) sample, and throughout this sample it's assumed that you're familiar with that sample. In addition, you'll use the technique described in the [Simple Animation](https://github.com/DDReaper/XNAGameStudio/wiki/Simple Animation) sample to animate the tank.

Other items in the Collision Series:

[Collision Series 1: 2D Rectangle Collision](https://github.com/DDReaper/XNAGameStudio/wiki/Collision Series 1 2D Rectangle Collision)

[Collision Series 2: 2D Per-Pixel Collision](https://github.com/DDReaper/XNAGameStudio/wiki/Collision Series 2 2D Per-Pixel Collision)

[Collision Series 3: 2D Collision with Transformed Objects](https://github.com/DDReaper/XNAGameStudio/wiki/Collision Series 3 2D Collision with Transformed Objects)

[Collision Series 4: Collision with a Heightmap](https://github.com/DDReaper/XNAGameStudio/wiki/Collision Series 4 Collision with a Heightmap)

All content and source code downloaded from this page are bound to the Microsoft Permissive License (Ms-PL).

XNA_Collision5_HeightmapNormals_01_small.jpgXNA_Collision5_HeightmapNormals_02_small.jpg

downloads

TankOnAHeightMapSample_4_0.zip

Size: 13.57MB

Source code and assets for the Collision Series 5: Heightmap with Normals Sample (XNA Game Studio 4.0).

Clone this wiki locally