Well, that was no fun lol
![Razz :P](./images/smilies/icon_razz.gif)
![Sad :(](./images/smilies/icon_e_sad.gif)
So you have a video tutorial designed with audio, but has no audio and could have been done in 10 mins for this level of tutorial.
again oh well....
heres the video:
Note: Its processing but it is HD
Here are some of the points i made for myself when discussing on the video:
- The first part of the video is to show how quick it can be done to get characters moving on the navmesh.
- The second part of the video when the scene is closed and start working on another skyline copy from scratch is showing how to do it from scratch.
- The third part of the video is with the RoyalSorceress character and the Mesh Editor explaining about Pivots and how they can affect the agent.
- Navmesh Agents are the controllers for the Entities that are moving. They are controlled by the navmesh and are told to go along the path line that is got from the setDestination().
With the cube which is non physical, it has its position "set" each frame to that of the Agents(green wired sphere).
With the SCC or DCC, the agent moves in front of the character and slows to let the character keeps up. The character is moved by the physics engine to follow the agent. - The agent is the sphere around or in front of the SCC.
- The scene has characters that use SCC's(Simple Character Controllers) and also a non physics cube.
- The same code can work for SCC and non physics entity.
- For DCC's(Dynamic Character Controller), you have to use navmesh.addDCC(dccID); instead of navmesh.addEntity(obj);.
- Single nav mesh creates a navmesh over all surfaces and you do not have the ability to reload or delete specific areas.
It is generated on load and is not stored in a file like the Tiled nav mesh is, but it is fast to generate.
- Tiled Nav mesh uses a grid based system that gives you more flexibility on how you use the navmesh.
For instance, you can remove tiles in areas that the AI cannot go or you don't want them to walk in
and you also have the ability to reload certain grid tiles which is great and quick for once you have edited an area
or in your game you have a closed door that opens. Reload the navmesh to et the characters through. Makes sense. - Currently there is no turn speed.
- The Grid resolution is for controlling the size tiles that are generated for the Tile Based Navmesh, lower numbers
will increase the resolution of the navmesh built for areas that are small but have a lot of height in the area to be ran on.
Smaller resolutions will use more memory though.
Here is the script for an SCC character. It can be used on characters with no animations as well.
- Code: Select all
obj = 0;
function onInit(objID)
sky.lprint("LUA: Script Active!");
obj = objID;
end
function postInit(objID)
navmesh.addEntity(obj);
navmesh.showAgentDebug(obj, 1);
navmesh.setAgentMaxSpeed(obj, 5);
pos = newType.vec3(entity.getPosition(entity.getIDFromTag("EndPoint")));
lprint("pos: x: "..pos.x.." y: "..pos.y.." z: "..pos.z);
navmesh.setDestination(obj, pos.x, pos.y, pos.z, 0);
lprint("anim: "..anim.getFromMap(obj, "Walk"));
anim.playAnimation(obj, anim.getFromMap(obj, "Walk"), 0, 0);
end
function onUpdate( timeDelta )
if( navmesh.isDestinationReached(obj) == 1)then
lprint("Reached Destination!");
navmesh.setAgentControlled(obj, 0);
lprint("anim: "..anim.getFromMap(obj, "Idle1"));
anim.playAnimation(obj, anim.getFromMap(obj, "Idle1"), 30, 1);
end
end
Sorry for the rant and i hope you find it useful.....
![Smile :)](./images/smilies/icon_e_smile.gif)