I've created a terrain with the following code (where 'heightMap' is a 64x64 float array)
Code: Select all
terrain = new Terrain(heightMap, new AffineTransform(new Vector3(4, 1, 4),Quaternion.Identity,new Vector3(-64 * 4 / 2, 0, -64 * 4 / 2)));
I have a visual mesh that aligns exactly with the terrain collidable (for texturing). This seems to match it as it should (if I drop a ball on it, it 'appears' to react with the visual mesh).
Now comes the weird part. I have 2 raycasts, 1 going from the camera location in the direction of the mouse pointer and 1 going directly downwards from the camera so the camera
conforms to the terrain height. Both of these raycasts return false whenever they hit the terrain (or where the terrain should be) past x=124 or z=124. (e.g x=124.1, z=2 returns false AND x=56, z=124.5 returns false). So if I place a ball at x=120 z=20 on the terrain and watch it roll downhill, it does so perfectly for a moment and then falls through the terrain when it gets to x=124.
Help!