XNA Game Development Forums
2012/05/21 19:03:03 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Calendar Login Register  
Pages: [1]
  Print  
Author Topic: Camera Issues  (Read 2811 times)
Trano
Newbie
*
Offline Offline

Posts: 3


View Profile WWW
« on: 2007/04/23 18:44:46 »

I am trying to get the camera class from the tutorials to work how I want it to and am having some issues.

I basically have a landscape that I want to be able to move around on like a strategy game.  The problems I am having are with trying to be able to rotate around the poin on the landscape that the person is looking at.  When I try to use the revolve method, it acts like rotate instead and I am not sure why.  I get the rotation, but the position is not updated.  Also, the scene shakes when I do the rotate.  I have tried to figure out why this happens, but I can't seem to figure it out.

Anyone have any ideas how to get the camera to act this way, or at least what would make my revolve stop working?

These are my functions and how I call them:

Code:
public void Rotate(Vector3 axis, float angle)
{
    axis = Vector3.Transform(axis, Matrix.CreateFromQuaternion(_rotation));
    _rotation = Quaternion.Normalize(Quaternion.CreateFromAxisAngle(axis, angle) * _rotation);

    Update();
}

public void Revolve(Vector3 axis, float angle)
{
    Vector3 revolveAxis = Vector3.Transform(axis, Matrix.CreateFromQuaternion(_rotation));
    Quaternion rotate = Quaternion.CreateFromAxisAngle(revolveAxis, angle);
    _position = Vector3.Transform(_lookAt - _position, Matrix.CreateFromQuaternion(rotate)) + _lookAt;

    Rotate(axis, angle);
}

CameraManager.ActiveCamera.Revolve(new Vector3(1, 0, 0), mouseMove.Y * 0.01f);
CameraManager.ActiveCamera.Revolve(new Vector3(0, 1, 0), mouseMove.X * 0.01f);
Logged
BAS
Newbie
*
Offline Offline

Posts: 2


View Profile
« Reply #1 on: 2007/04/25 03:45:32 »

I don't have an answer for you, but I've also noticed some strange things happening with the cameras in these tutorials.

Rotate for example, it seems to end up rotating around the 3rd axis for some reason, as though you were tilting your head to the side.  It's like there's some sort of accumulation error happening, I don't understand the maths though... Sad

Logged
Nemo Krad
Global Moderator
Hero Member
*****
Offline Offline

Posts: 512


I have seen the fnords


View Profile WWW
« Reply #2 on: 2007/04/25 04:12:48 »

That is because there is no gimbal lock on the camera, there have been solutions posted on here for it, if that is what you want, do a search and see what you find.
Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #3 on: 2008/09/17 08:27:25 »

This has been solved. See: http://www.thehazymind.com/smf/?topic=382.msg7629
Logged
Pages: [1]
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Having issues with tutorial 3 Hazy Mind XNA Engine siferion 4 2377 Last post 2006/11/26 14:04:03
by mikeschuld
Tutorial 12 :: Adding in Advanced Camera Functionality Tutorial Discussion « 1 2 3 » mikeschuld 30 11116 Last post 2007/08/01 07:00:20
by Suzume
Parenting Camera to an Object Hazy Mind XNA Engine Requests rstackhouse 4 3098 Last post 2007/03/14 06:13:57
by 5parrowhawk
Not good - issues in the first tutorial. Hazy Mind XNA Engine « 1 2 » Jeddak 20 5375 Last post 2007/03/26 19:31:08
by mikeschuld
Camera Issues Hazy Mind XNA Engine minich21 6 3047 Last post 2007/08/14 21:27:30
by mikeschuld
J.I Styles skin shader implementation issues Hazy Mind 3D Engine DX 1 2117 Last post 2007/03/30 07:53:25
by Nemo Krad
Camera Tracking Hazy Mind XNA Engine muchrejoicing 4 2006 Last post 2007/05/29 19:50:23
by daenris
Camera problem Hazy Mind XNA Engine Montynis 2 1685 Last post 2007/08/02 09:54:14
by Montynis
Tutorial 9 - issues with some code Hazy Mind XNA Engine Mike2 3 2003 Last post 2007/08/31 22:30:19
by ChunkyBrewster
GameTime issues General Discussion Mike2 2 2020 Last post 2007/09/14 15:22:07
by Mike2
Mouse Input Issues Hazy Mind XNA Engine Silvo 3 2465 Last post 2008/09/15 00:10:11
by mikeschuld
Camera rotation issues (z-axis drift solved!) Hazy Mind XNA Engine ppardee 10 4271 Last post 2008/11/19 11:22:49
by inbreed
extending the camera classes/cameramanager Hazy Mind XNA Engine Mikeske 7 2079 Last post 2009/12/16 01:46:28
by Mikeske
Powered by MySQL Powered by PHP Powered by SMF 1.1.12 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.561 seconds with 19 queries.