PandaAi behaviours tilt models

Hi to all;

I’ve been testing PandaAi and I’ve run into a problem whereby, whenever I use any of the steering behaviours on a model and then adjust the model’s height continuously via getElevation() on a mesh generated from a heightmap, the model tilts upwards or downwards at times. Obviously this is rather unsightly. How would I go about preventing this tilt from happening? What I basically do is:

-start particular steering behaviour
-start a task that:
- properly updates model’s Z value based on its position in the map via getElevation()
-updates AI world.

[ Note that where possible, the parameters I give the steering behaviours are all along the XY planes. So for instance if I want a model to go to a particular position (via flee or seek for example), I will give it the position’s xy coordinates but set the Z to zero.]

If not, are there any other ai alternatives?

You would need a dummy node that’s controled by the AI and then copy its xy and h to your visible model. Keep in mind that PandAI is not 100% bug free, for me it can crash at times
Alternatives? I’ve seen some talk about recast / detour on IRC but I know nothing about it’s current status.

it may be caused by the inaccuracy of getElevation(). look at accurate getGroundHeight algorithm for GeoMipTerrain for an alternative of the function. it may help.

Wezu wrote:

Of course! Thanks for the idea. Well, if it’s the only AI system that this engine supports, and you say that it has other issues…that paints a rather dismal picture. Though I feel that even without it, most if not all of the steering behaviours can be reproduced using parallels, sequences, tasks and so on.

MichaelPanda wrote:

Might be, I’ll have a look if it helps.

By any chance, would your models be pointed at something? Because if we alter the elevation, that would require a tilt to maintain the same “pointed orientation” and I find it odd that you believe the AI to be changing the orientation of the models. Have you debugged enough to figure out which property changes, or are you just at the visual stage of debugging?

rorschachrev wrote:

Hello there.

Using Wezu’s suggestion worked perfectly, basically assign the AI behaviours to a dummy node and then continuously copy the XY and H of the dummy node onto the actual node that I intended to control. As such I didn’t really look that deeply into the issue and moved onto a different aspect of the game. I however don’t think that my models are pointed at anything; I just load them, re-parent them to render and then do the AI. Coincidentally however, I should be able to start extending the use of the AI class, since currently, all I use it for is to make the models I put into the scene wander around the terrain, and so I’ll have a chance to look deeper into it then. I’ll tell you the results of my deeper debugging when I commence on the aforementioned step.