Jump to content


Photo

first person mouse looking bug


  • Please log in to reply
5 replies to this topic

#1 DudeGuy676

DudeGuy676

    GMC Member

  • New Member
  • 47 posts
  • Version:GM:Studio

Posted 26 June 2012 - 07:51 PM

I've recently started learning how to program in 3d, and so far I've developed this code for using the mouse to look around

Spoiler


the problem is, when I'm getting close to looking straight up, the sensativity of the mouse (or camera) goes down alot. (I'm moving the mouse alot more to get less movement in the camera). Does anyone know how to fix this?
  • 0

#2 Gamer3D

Gamer3D

    Human* me = this;

  • GMC Member
  • 1590 posts
  • Version:GM8.1

Posted 26 June 2012 - 08:54 PM

Divide the horizontal rotation by cos(obj_camera.zdirection)

Note: When using this method, never look straight up.
  • 0

#3 DudeGuy676

DudeGuy676

    GMC Member

  • New Member
  • 47 posts
  • Version:GM:Studio

Posted 26 June 2012 - 09:44 PM

I tried that and it ended up with very chaotic results. The point of this is to actually be able to look straight up withought the camera spinning out of control.
  • 0

#4 Gamer3D

Gamer3D

    Human* me = this;

  • GMC Member
  • 1590 posts
  • Version:GM8.1

Posted 27 June 2012 - 02:34 AM

I tried that and it ended up with very chaotic results. The point of this is to actually be able to look straight up withought the camera spinning out of control.

Ah. Not sensitivity.

You'll want to modify the up vector for the projection.
  • 0

#5 DudeGuy676

DudeGuy676

    GMC Member

  • New Member
  • 47 posts
  • Version:GM:Studio

Posted 27 June 2012 - 02:42 AM

Ah. Not sensitivity.

You'll want to modify the up vector for the projection.


could you please elaborate? I tried a number of things and they all failed.
  • 0

#6 Gamer3D

Gamer3D

    Human* me = this;

  • GMC Member
  • 1590 posts
  • Version:GM8.1

Posted 27 June 2012 - 10:26 PM


Ah. Not sensitivity.

You'll want to modify the up vector for the projection.


could you please elaborate? I tried a number of things and they all failed.

When the look vector <xto-xfrom,yto-yfrom,zto-zfrom> is parallel to the up vector <xup,yup,zup>, d3d has no means of determining the intended orientation. A simple way (Not the best way, but should work for your purposes) is to change the up vector from <0,0,1> to <cos(direction)*(yfrom-yto),sin(direction)*(yfrom-yto),1>. This will allow the camera to function even when facing straight up or straight down.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users