From NPC combat to path following and all AI related tasks.

Detour functions to Lua

Detour functions to Lua

Postby SpiderMack » 16 Apr 2018, 13:48

Hi,

There is important Navmesh functions to create advanced AI.
Many are already included in Detour Api, SKyline just needs to interface them to Lua.


findRandomPointAroundCircle
Used a lot to create dynamic AI moving everywhere around the player

dtStatus dtNavMeshQuery::findRandomPointAroundCircle(dtPolyRef startRef, const float* centerPos, const float maxRadius,
const dtQueryFilter* filter, float (*frand)(),
dtPolyRef* randomRef, float* randomPt)


raycast
Faster than physics raycast when testing environment, and usefull to identify static walls and obstacles

dtStatus dtNavMeshQuery::raycast(dtPolyRef startRef, const float* startPos, const float* endPos,
const dtQueryFilter* filter,
float* t, float* hitNormal, dtPolyRef* path, int* pathCount, const int maxPath)

getCost
Navigation cost.
Can be used to compare two possible destination cost or used for gaemplay like checking if sound propagation reaches a destination.


float dtQueryFilter::getCost(const float* pa, const float* pb,
const dtPolyRef /*prevRef*/, const dtMeshTile* /*prevTile*/, const dtPoly* /*prevPoly*/,
const dtPolyRef /*curRef*/, const dtMeshTile* /*curTile*/, const dtPoly* curPoly,
const dtPolyRef /*nextRef*/, const dtMeshTile* /*nextTile*/, const dtPoly* /*nextPoly*/)


closestPointOnPolyBoundary
Closest point into a boundary poly

dtStatus dtNavMeshQuery::closestPointOnPolyBoundary(dtPolyRef ref, const float* pos, float* closest)
User avatar
SpiderMack
Skyline Expert
 
Posts: 441
Joined: 02 Dec 2016, 09:15
Skill: Concept artist
Skill: 3D Modeller
Skill: Level Designer
Skill: Scripter

Re: Detour functions to Lua

Postby SolarPortal » 16 Apr 2018, 18:37

Thanks for those.. it helps alot..
We will add these to the todo list...

Do you want to make an entry on the ticket site: https://support.aurasoft-skyline.co.uk
Conceive, Quantify & Do!
Skyline Game Engine - Lead Developer.
Please provide as much information as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 3770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3134
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Detour functions to Lua

Postby SpiderMack » 16 Apr 2018, 20:33

Those functions can be found on Recast Detour source code on GitHub
https://github.com/recastnavigation/recastnavigation

There is more functions, some could be usefull like getting a list of navigation points to let the user code itself the character movement (and this would allow us to fix the actual rotation issues when using navmesh on SKyline).

I'll make a ticket.
User avatar
SpiderMack
Skyline Expert
 
Posts: 441
Joined: 02 Dec 2016, 09:15
Skill: Concept artist
Skill: 3D Modeller
Skill: Level Designer
Skill: Scripter


Return to AI

Who is online

Users browsing this forum: No registered users and 2 guests

cron