I've just spent several hours trying to find out what was wrong with my navigation code in my game. It had worked up until the last changes I made to the level. This time when I tried to calculate the navigation mesh I got an invisible wall blocking my way!
I could not see anything in my code and none of my debug output showed what could be causing the problem. Eventually I found it. Not my code! It was that one of the models I had exported from Blender had a rotation left on it!
The rotation in the top right of the above screen shot from Blender is what had been causing me problems. I will repeat for my own benefit...
Before exporting for use in XNA make sure that none of the rotaions or scale have been set and make sure the object is located at zero.
That's what it should be.
I don't know why but the model appeared to look correct in XNA. When I displayed where I calculated all the triangles were they were at 90 degrees to where the model was rendered!
Rotating the model in Blender and exporting again fixed the problems.
I'm happy it was not my code but annoyed I didn't spot it while creating the model!
All models need to be created just like my animated export instructions:
http://blog.diabolicalgame.co.uk/2011/07/exporting-animated-models-from-blender.html
One more thing...
remember to add the Edge Split modifier to ensure square edges appear square when rendered.
Sunday 19 August 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment