开发者

xna camera following the object in 2 axes?

开发者 https://www.devze.com 2023-02-26 06:48 出处:网络
ok so at the moment a camera is following the object consistently only in 1 axis. here is the code: Matrix rotationMatrix = 开发者_StackOverflow社区Matrix.CreateRotationY(avatarYaw);

ok so at the moment a camera is following the object consistently only in 1 axis. here is the code:

        Matrix rotationMatrix = 开发者_StackOverflow社区Matrix.CreateRotationY(avatarYaw);
        Matrix rotationMatrix2 = Matrix.CreateRotationX(avatarXaw);

        Vector3 transformedheadOffset2;
        Vector3 transformedReference2;

            transformedheadOffset2 = Vector3.Transform(AvatarHeadOffset, rotationMatrix);
            transformedReference2 = Vector3.Transform(TargetOffset, rotationMatrix);

how can i make it follow the object in 2 axes? (obviously something to do with rotationMatrix2) , since when i use something like:

transformedheadOffset2 = Vector3.Transform(transformedheadOffset2 , rotationMatrix); everything goes fuzzy. Any insight will be helpful. thanks


It is difficult to know exactly what your camera issue is. Here is a video I made to explain a common camera problem that may (or may not) be applicable to your issue.

http://www.screencast.com/users/sh8zen/folders/Xna/media/929e0a9a-16d1-498a-b777-8b3d85fd8a00

I'm not trying to just push a video I made... It's just that after 3.5 years on the xna forums, the problem that the video addresses has come up countless times from beginners working with cameras. Also, based on your description of the problem, it is very difficult to know what your camera is doing wrong so it stands a reasonable chance of being this issue.

0

精彩评论

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

关注公众号