c# - XNA 3D Camera rolling -
i'm using photographic camera class xna seabase alpha, , works great, didn't have modify @ all. but, if strafe horizontally , yaw @ same time, changes roll , can't figure out how 'lock' in way can never roll. (similar first person shooter, can strafe, thrust, , adjust it's pitch , yaw.)
my code calling class follows:
if (gamepadstate.thumbsticks.right.x != 0) { // around camera.yaw(-gamepadstate.thumbsticks.right.x); } if (gamepadstate.thumbsticks.right.y != 0) { // around camera.pitch(-gamepadstate.thumbsticks.right.y); } if (gamepadstate.thumbsticks.left.x != 0) { // move around camera.strafehorz(-gamepadstate.thumbsticks.left.x); } if (gamepadstate.thumbsticks.left.y != 0) { // move around camera.thrust(gamepadstate.thumbsticks.left.y); } if (gamepadstate.buttons.leftshoulder == buttonstate.pressed) { camera.strafevert(0.2f); } if (gamepadstate.buttons.rightshoulder == buttonstate.pressed) { camera.strafevert(-0.2f); }
i've tried forcing vector in photographic camera class vector(0, 0, 1)
, vector(0, 1, 0)
. settings z 1 helped bit, still able roll.
if have no intention of ever implementing roll in camera, best modify seabase code thus:
public matrix viewmatrix { { homecoming matrix.createlookat(position, forward+position, vector3.up);//changed 3rd param tovector3.up } }
this inhibit arbitrary roll experiencing. preclude implementing roll too.
c# xna
No comments:
Post a Comment