Hi,
I use a very simple raycast function to get the Y height of the collision point from the camera to the terrain (cast ray from camera->getPosition() to camera->getPosition() + vector3df( 0, -10000, 0 )). However, after manually moving the terrains vertices up/down, the Y position of the ray stays the same.
I'll break it down to explain it.
1. Cast ray.
2. Alter terrain vertices right below the camera.
3. Cast ray again.
The result is exactly the same UNTIL I re-create the Terrain mesh from the new heightmap, then it gets the correct results. How would one go about fixing it?
Thanks.
Raycasting not accurate after manually altering mesh?
Re: Raycasting not accurate after manually altering mesh?
Hi Panto,
The reason is probably because you haven't updated the terrain collision data (I'm not familiar with Irrlicht's collision system classes).
The reason is probably because you haven't updated the terrain collision data (I'm not familiar with Irrlicht's collision system classes).
Re: Raycasting not accurate after manually altering mesh?
I thought that when "refreshing" the mesh (node->setPosition( node->getPosition() )) it would automatically recalculate the terrain triangle selector. But I'm probably wrong, I'll check it out, thanks.