76 Commits

Author SHA1 Message Date
Anton Matveev
9df3e2e0a6 Fix rounding error due to precision loss after optimization. 2022-10-12 00:03:00 -04:00
Jan Haller
9dc88fcab9
Validate constraint: #polygons per tile (#449)
* Validate constraint: #polygons per tile

When adding a tile to a NavMesh, ensure that the number of polygons in that tile fit in the poly ID address space.

* Improve dtNavMeshParams field documentation
2020-11-19 10:13:30 +01:00
Jakob Botsch Nielsen
54bb0943e5 Make closestPointOnPoly and getPolyHeight more robust
* Make dtClosestHeightPointTriangle use no epsilon (except for checking
denominator)
* When point is outside poly, directly find closest height from boundary
detail edges instead of first interpolating and then finding height from
detail tris.
* When point is inside poly, if all dtClosestHeightPointTriangle queries
failed, then find height from detail edges. This should only happen if
the point is right on top of an internal detail tri edge.
2019-03-16 16:18:23 +01:00
cexikitin
05dd77db19 Provide better feedback when dtNavMesh::addTile fails due to a tile already being present at a given x,y 2018-03-20 00:05:29 +01:00
aymarfisherman
7cca61dc41 Renamed all instances of 'extents' to 'halfExtents' (#279) 2017-08-20 17:05:51 +02:00
Jakob Botsch Nielsen
88b8d409a7 Properly use detail mesh from closestPointOnPoly (#228)
When a point is outside the polygon being queried in
dtNavMesh::closestPointOnPoly and dtNavMeshQuery::closestPoinOnPoly,
Detour will interpolate along one of the edges to find the closest point
on the poly. However, Detour did not properly use the interpolated point
to find the correct height according to the detail mesh.

Fix #227
2016-09-07 10:55:35 +02:00
tfabretti
16bea738b8 Fixed a links issue due to offmesh connections
When creating the tile's links, offmesh connections inside the tile were
added twice, leading to the array of links being full and not being able
to store the links computed after (portals between tiles).
2016-05-02 20:59:51 +02:00
Ben Hymers
222fa1ee6f Fix possible out of bounds array access in Detour closest point functions
These were reported by Coverity Scan. They're extremely unlikely but still
possible - if all edges of a poly are FLT_MAX or further away from the
input point, a negative index may be used to access the verts array of a
poly.

The fix is to arbitrarily pick the first edge as the closest in case all
are tied as being very far away.
2016-03-14 10:22:31 +00:00
Ben Hymers
c208fd332c Minor typo and style changes 2016-03-14 09:03:40 +00:00
Ben Hymers
40a88dae73 Fix blank assignments while advancing through buffer, using new dtGetThenAdvanceBufferPointer 2016-03-14 09:03:39 +00:00
Jakob Botsch Nielsen
67590642c7 Add documentation about data to addTile
dtNavMesh needs exclusive access to the data passed to addTile since it
will make dynamic changes to this at runtime. For that reason the data
should not be reused until the tile has been removed from the nav mesh
again.

Fix #149
2016-01-14 00:27:40 +01:00
Jakob Botsch Nielsen
e2cc5ae419 Correctly remove off mesh links to other layers
External links representing off mesh connections between layers in the
same tile location would not be correctly removed. These links had
side = 0xff which were skipped during tile removal under the assumption
that these links were internal.

Also correct some comments in the same place.

Fix #113
2015-12-29 17:51:15 +01:00
Kromster80
0ccf9fbb6c Removed unnecessary assignment 2014-11-16 21:32:29 +03:00
Mikko Mononen
19e2d8dbe6 Fixed pos-over-poly case for finding nearest polygon 2014-02-16 11:27:45 +02:00
Mikko Mononen
6702143bc1 Fix for broken raycasts, changes how findNearestPoly works, slight API change
- test case supports raycasts
- changes how findNearestPoly works directly over polygons
- API change: findNearestPoly has additional parameter
2014-02-11 20:32:00 +02:00
Mikko Mononen
6a7f5268ab Added define to compile Detour with 64bit dtPolyRefs 2013-12-22 18:01:06 +02:00
Matthew Endsley
b0e4e6a834 Add wrappers for the standard math library
Simplifies transition to software based math libraries
for projects requiring determinism.
2013-09-15 20:09:01 -07:00
Mikko Mononen
de6fd8c3ef - use "cylinder distance" for nearest point in polygon
- added option for findStraightPath() to append vertices at get edge crossings
- added scale parameter for .obj loader
2012-09-05 05:57:31 +00:00
Mikko Mononen
64802ecd0e - Improved unconnected off-mesh connection debug draw
- Fixed connecting off-mesh links which connect to the same tile x,y but different layer
- Fixed crash in navmehs query closestPointOnPolyInTile() when the poly is off-mesh connection
2012-06-12 03:28:43 +00:00
Mikko Mononen
f6c8d9c780 Clear navmesh params on navmehs constructor. 2012-03-10 19:58:38 +00:00
Mikko Mononen
a12afd675f 64bit fixes for address calcs. 2012-02-22 19:36:18 +00:00
Mikko Mononen
e6b1d141d2 Fixed warnings when compiling with -Wshadow. 2012-02-22 17:25:46 +00:00
Mikko Mononen
11d0942a6b Fixed a bug where off-mesh connections w/o BV-tree would crash. 2012-02-04 21:16:37 +00:00
Stephen Pratt
82a5c863eb Detour: Added detail API documentation covering DetourNavMeshBuilder.h.
Plus some minor tweaks to other Detour documentation.
2011-09-19 20:37:11 +00:00
Stephen Pratt
c150272f99 Detour: Detail API documentation covering the DetourCommon.h and DetourNavMeshQuery.h files 2011-08-15 17:01:16 +00:00
Mikko Mononen
1de5e2f119 DETOUR API CHANGE!
- Detour Navmesh supports layers
- Allow to disable Navmesh BV-tree
- Added DetourTileCache
- Cleaned up Recast layer code
- Moved portal edge detection to Recast
- Removed polymesh border offset
- Removed lean heighfield
2011-03-25 09:16:38 +00:00
Mikko Mononen
1080b6c249 Fix for Issue 162. 2011-02-09 18:52:25 +00:00
Mikko Mononen
08741e894c DETOUR return status codes changed, check blog! Changed Detour status codes to be bitfields which describes the highlevel status plus some details about the failure or quality of the result. 2010-11-26 11:56:34 +00:00
Mikko Mononen
7fbcfa9c4b Fixes for issue 147, issue 143, issue 140 2010-11-21 14:59:58 +00:00
Mikko Mononen
1be9de72d8 Detour version change! Added user ID per off-mesh connection. Fixed off-mesh connection draw flags after using off-mesh con tool. 2010-11-07 15:21:38 +00:00
Mikko Mononen
e5d603ac92 **API CHANGED** Implemented issue 124. Detour API returns error codes. 2010-10-29 12:08:13 +00:00
Mikko Mononen
034fbbc67d Fixed Detour to work when using 64bit polyrefs. 2010-10-15 06:57:45 +00:00
Mikko Mononen
4cf5ab4d7b Fix for issue 125. 2010-09-24 06:15:01 +00:00
Mikko Mononen
f5bb64a375 Fix for Issue 123. 2010-09-17 07:25:19 +00:00
Mikko Mononen
e65903dfce The humble beginnings of dtObstacleAvoidanceQuery, figuring out the API. Moved value graph/history to ValueHistory.h/cpp and changed the draw code to use imgui. Various tweaks to CrowdTool. 2010-08-31 12:36:32 +00:00
Mikko Mononen
3f0995dc1c Allow dtNavMesh m_tileBits and m_polyBits to be zero. 2010-08-24 21:02:31 +00:00
Mikko Mononen
057c3e9bfd Commented assert headers for encouraged usage. Navmesh query stores const dtNavMesh pointer. 2010-08-24 18:11:06 +00:00
Mikko Mononen
47ba806fef Fix for Issue 107 2010-08-23 17:40:45 +00:00
Mikko Mononen
cbc47f4ddf Fix for Issue 99:Separate Detour mesh queries in to a different class from mesh data 2010-08-17 15:10:32 +00:00
Mikko Mononen
474a3ddc67 Changed link bmin/bmax to fraction along the edge. Fixed moveAlong to work with multiple links per edge. Use flat delta for path iterator. 2010-08-10 10:43:28 +00:00
Mikko Mononen
81c0402116 Missing changes from previous commit. Added dtNavMesh.findLocalNeighbourhood() and dtNavMesh.getPolyWallSegments() and test code for them. 2010-08-09 13:28:26 +00:00
Mikko Mononen
d83961ecd4 issue 46:getPolysAround with convex polygon query bounds 2010-07-21 07:11:37 +00:00
Mikko Mononen
99401f3944 offmesh con was using sizeof(new unsigned char), removeTile() was still using delete[]. 2010-07-10 09:00:26 +00:00
Mikko Mononen
e5cca88cd1 Custom memory allocator for Detour. Fixed parallel touching portal connection. 2010-07-09 10:37:49 +00:00
Mikko Mononen
122ee3a7a1 Issue 86:Tiled world consisting of one tile - dtNavMesh::init fails. ___NOTE: dtPolyRef format changed___ 2010-07-08 12:04:43 +00:00
Mikko Mononen
2aa749c940 Fix for Issue 81. Fixed getPolysAround() and findDistanceToWall() when using off-mesh connections. 2010-05-26 09:46:02 +00:00
Mikko Mononen
1769d70e5c Fix for Issue 70: more const methods, Fix for Issue 72: changed to more accuracte tile connection test. 2010-04-22 13:13:27 +00:00
Mikko Mononen
32b54f7981 Fix for Issue 68 2010-04-19 14:01:13 +00:00
Mikko Mononen
6f1e34e9fe Raycast does not try to follow off-mesh links (Issue 64), use references instead of pointers in debugdraw api (Issue 62, Issue 63) 2010-04-15 07:22:47 +00:00
Mikko Mononen
10b330ffb4 Moved common functions behind name decoration. 2010-04-14 18:45:46 +00:00