I am having a problem getting my model to correctly walk over the top of my terrain properly. The normal action is for the model to sink into the higher regions of terrain, bit annoying really.
In the initial position, you are using 64,64 as the position in your terrainblock, while placing it at local translation 1280,1280. In the update you are using the local translation directly as the position in the terrain block.
Is this as intended?
Also, in the initial positioning, you are adding 50 to the height, whereas in the update you are not?
This offset may be because the model is positioned about it's center, not it's feet?
Also, you hint that the model is animated, in which case it is probable that the feet move relative to the object. This would be more complex to account for but probably not cause such large discrepancies (though it is hard to tell how large they are from that screenshot).
no visible difference, - i must admit im surprised at how this has to be done manually, in other engines, you simple apply an animator and then some gravity and this is done for you :S
Well, having the engine do something for you is not necessarily desirable. There is always a choice to be made between how much effort you want to put in versus how much freedom you want.
Anyway, if adding a constant to the position makes no difference it sounds like something else is wrong.
I would check the obvious things like is that statement ever actually getting executed, is the enemy being positioned again somewhere else in your code, etc.
If getLocalTranslation returns the very center of the model associated with the node, then i will need to include this in the calculations, because its not the center we are worried about, its the feet, surely?
Does this sound right? If this is the case, how do I workout how tall my model is and discount it :S
It will interpolate for you, as long as you set the step scale in the constructor.
So a 128x128 map with a step scale of 10 would mean 1280,1280 is the corner now 128,128.
You are right about needing to account for the feet offset in the if statement, still need to do it in the set aswell though (noticed it's commented out in the snippet).