OgreNavLib

From ISXOgre
Revision as of 14:29, 14 November 2017 by Kannkor (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

OgreNavLib

What is OgreNavLib?

OgreNavLib is a library of commands I have written, so scripts can navigate the world. This is a complete rewrite of 'OgreNavLib.inc', which will be phased out and not updated.


This will primarily be used by advanced scripters, such as myself, BJCasey, Pork, etc, to automate navigating. While technically anyone is welcome to use it, it will require a solid understanding of LavishScript to use.

What's new over the old one?

It was completely re-written from the ground up. The movement is better, the error reporting is better, the code is better, and debugging it is 100 times better.

Oh, did I mention, it supports flying?

How to use it? - Without creating a script - Basic example

For basic use, it will be nearly identical to the old way. You create a map: (this command may change): ogre navmap

While you're creating your map, you can fly as you see fit, land when you want, and fly again.

Note: Technically creating a map is not required, as with before, if there is direct line of sight with no obstacles, it will go directly there, including flying to/from a location.


When you want to move some where, you do the same as what you have done previously:

You navigate to it. (This command will likely change): ogre navtest <parameters>

  • Note: ogre navtest is identical to ogre nav, except it uses the new lib instead of the old one. But all flags will. Such as -loc, -ntr, -tr, etc etc.

For example:

  • ogre navtest Point1
    • You would navigate to a custom named point of 'Point1'
  • ogre navtest -loc 10 30 -382
    • You would navigate to a location of: 10,30,-382

How to use it? - With creating a script

This will give you more control over how the lib works, but for obvious reasons, is way more technical.

Create a script, and include the library, then create the library, change any values in the library you wish to change, then have start the navigation.

There are two files (or, will be), in your /Scripts/OgreNav/ folder. OgreNavExample.iss and OgreNavExampleAdvanced.iss

  • OgreNavExample.iss is a very basic example of how to use it, with nearly no options changed from the default.
function main(string _Location="WhereDoYouWantToGo")
{
	ogre navlib
	wait 5
	Obj_OgreCreateNavLibs:CreateNavLib[${Script.Filename}]
	Obj_OgreCreateNavLibs:CreateNavEntry[${Script.Filename}]
	
	OgreNavEntry:Set_Location["${_Location}"]
	call OgreNavLib.OgreNav OgreNavEntry
}

There are 3 parts to note, that will be required before using the Nav lib.

  • Step 1: Make sure the navlib is loaded, and wait some indetermined amount of time for it to load.
	ogre navlib
	wait 5
  • Step 2: Create the Nav lib
    • This creates 'OgreNavLib' for you.
    • See <this link> for members and methods of OgreNavLib.
	Obj_OgreCreateNavLibs:CreateNavLib[${Script.Filename}]
  • Step 3: Create a navigation entry.
    • This is how you tell the nav lib where you want to go.
    • See <this link> for members and methods of OgreNavEntry.
	Obj_OgreCreateNavLibs:CreateNavEntry[${Script.Filename}]

The rest is pretty basic. You modify anything in NavLib/NavEntry, then you call OgreNav and pass it the Entry. Simple huh?