swordlegend / recastnavigation

Automatically exported from code.google.com/p/recastnavigation
zlib License
0 stars 0 forks source link

Negative array access in dtNavMesh::raycast() #55

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This happens if the line segment doesn't hit
anything, that is if both ends are in the same poly.

My steps are:
1. Start Recast Demo
2. Open nav_test.obj and build as tile mesh with default settings
3. Select test nav mesh and Ray cast
4. Place both ends in the same poly

This returns 1 with a t value of 1.0. Also in the code I mention above
maxStep is -1 and used to index an array for calculating the hit
normal. 

It might be more intuitive it t was returned as 0 in this case. I don't
think it really makes sense to calculate a hit normal if there is no hit
either.

Original issue reported on code.google.com by cameron....@gmail.com on 11 Mar 2010 at 8:41

GoogleCodeExporter commented 9 years ago
Fixed in R142. Raycast returns now FLT_MAX if it did not hit anything, so "if 
(t >
1)" can be used to check if the ray did not hit at all, t == 0 is valid hit 
case when
close to a wall.

Original comment by memono...@gmail.com on 18 Mar 2010 at 8:08