开发者

Easiest way to position camera in XNA?

开发者 https://www.devze.com 2023-01-01 12:14 出处:网络
Everytime I load my model into XNA, I can usually see it far off in the distance. When I change some parameters and make it zoom up close, 10/10 times it\'s rotated funny and I\'m set with the task of

Everytime I load my model into XNA, I can usually see it far off in the distance. When I change some parameters and make it zoom up close, 10/10 times it's rotated funny and I'm set with the task of rotating it. Is there any easy way to do it except by experimenting? Or am I ex开发者_如何学JAVAporting it wrong (using Blender)? Is there any value I should set the objects in my 3d scene to be before exporting it so they appear 'upright'?


In case the same is happening for all your Blender Models, how about you apply a generic scaling and rotation to the World matrix of your models instead of playing around with the View matrix?


The problem is more than likely in how you are translating and rotating the matrices. You have to do all of your translations first, and then rotations.

The best way to troubleshoot this is by having a simple/base case to test against. For example, a triangle at origin (0,0,0). Position the camera a few points back on the Z and then start experimenting with translations and rotations. Once you get the hang of it with this basic test case, the math will work for all other cases.

Be sure to post more code if you want more specific help :-)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号