Working with Pathfinding I’ve needed to do some things I don’t normally do. Basically I avoid doing rotations as much as possible because I just have not gotten my brain around idea of Euler-Quaternion and why gimbal lock is a problem.
The new task I needed to accomplish is how to get my Pathfinding AI Character to look at someone in the area. We have lots of new functions that can be used to assist with that.
I looked at llLookAt(). This function points the positive Z-axis toward an agent or object. That creates an immediate problem because the llCreateCharacter() points the Z-axis up. I think one can rotate the Character to make the Z-axis horizontal, but that doesn’t work for my character that needs to be taller than it is wide.
The function llRotLookAt() looked to be a better choice. But the definition was so confusing I had a hard time using it. Searching the forum I found a couple of threads that explained the function and how it worked. If I had started with those, I could have saved myself a load of time experimenting.
Innula Zenovka, Rolig Loon, Void Singer, and Strife Onizuka helped in various ways to get me straightened out. Void Singer and Strife Onizuka helped me get the wiki changed to provide a better definition of the function’s behavior… or maybe they just cleaned up the mess I made of it. Whatever, we have a better wiki page for llRotLookAt() and some of my stuff survived. 🙂
The best part is that I have llRotLookAt() working with my Pathfinding Character.
There are a few example scripts of how to implement Pathfinding Characters. See: Pathfinding Example Scripts.
- For simple wandering characters: llWanderWithin_debugging
- For characters following a set coordinate path: llPatrolPoints_debugging
- For characters that avoid avatars: llFlee_debugging
- For path_update event: Path_update_debugging
The scripts have the code you’ll need to debug your characters. You WILL need to debug them.
The Beta and Development viewers have the Pathfinding Tools. You’ll need to look at the Navmesh to get an idea of why you character goes where it goes and why it dodges whatever it dodges.
I have found both of those viewers crash prone and …sticky… meaning the FPS and what I see on the screen seem out of sync. I have not yet found a way to reproduce the problem reliably and I can’t yet tell if it is my system or the viewer. But, Pathfinding (PF) Characters disappear in both. I’ll be clicking on a character and nothing is happening, then poof it rez’s someplace else. All the time the PF Character was moving. It only looked like it was stationary. Zooming in and out changes where the character appears. The parts of my 3 piece/prim character get strung out along the path and suddenly appear together farther along the path. It’s a mess.
It is not just my PF Character. Doors are doing something similar. I’ll click and open a door. But, it never moves. If I try, I can walk through the space where it appears to be. Also my cursor is no longer shows a click-hand over the door. If I move the cursor to where the open door should be, the cursor changes and I can click. Then sometimes I see the door poof open and start closing… it is very annoying using the Beta and Dev viewers for PF work… well much of anything.
I’ve been looking for an nVidia update, I’m on 301.42. NVIDIA is past due for a release, or so I think. There are not enough people using the PF Tool viewers for me see complaints appearing in the forum. So, I can’t really tell where the problem originates. Hopefully it will go away.
I have been trying to understand what gimbal lock is. This video explains it.[youtube zc8b2Jo7mno]
Now I know WHAT it is. I’m just not sure what I can do with the knowledge.
I understand why I convert in and out of Euler. I just have trouble understanding some of Euler/rotation/vector math and why it works such that I can predict the results.