Steve Exploring Stuff: A Little Bit of Recast for Unity


A Little Bit of Recast for Unity

It's been a while since my last post.  I've been working on various projects in parallel: dynamic obstacle avoidance, behavior, smart objects; and the first to reach a point worth sharing, navigation mesh generation in Unity.

The new NMGen is a wrapper for Recast with simple API's for use in Unity Pro and .NET applications.  This release only includes the ability to create static triangle meshes. But the foundation is in place to expose Recast's advanced functionality if I ever need it.

The project home includes links to code, documentation, and a Windows-compatible distribution.  The distribution includes a Unity package containing components, prefab's, and custom editors for non-programmers.

There are three main limitations in this release:

Use is not completely free since native plug-ins can only be used with Unity Pro.  I have some idea's on workarounds.  So this may not be a permanent limitation.

Sorry Mac users.  I don't have a way of building and testing for your OS.  So I can't create any distributions for you.

The Unity components can't create navigation meshes from Terrain objects.  This isn't a technical limitation.  I'm just not sure yet how to extract tree mesh information from the objects.  Also, the potential large size of the terrain is problematic.  (Threading in the Unity Editor ==  Potential ickiness.)

Enjoy the new code.  And have a happy <insert your favorite winter holiday here>.

1 comment:

  1. Hi,

    Great news about the alpha release (for me), a decent path finding solution was holding me back from porting over from Leadwerks to Unity.

    To get the terrain into recast I did (assuming terrain is in x/y cells): -

    For x = 0 to terrain width
    For y = 0 to terrain depth
    Get height of terrain (I believe this is possible in Unity) at cell corner
    Add vertex for corner
    Repeat to make quad….

    Why aren’t you broadcasting this on the Unity forum, the only other path finding solution is poor in comparison to what you’ve done?

    Chris Paulson