CodeKrash
17-03-2011 04:13:36
Hello, I'm having some luck with character controllers in physx, and have run into a mathematical noob problem that I need help with.
It works well, but the issue is that I'm totally limited to a 180 degree radius, and multiplying that by 2 to somehow increase its "resolution" only makes the rotation break. What critical piece of knowledge am I lacking here?
It works well, but the issue is that I'm totally limited to a 180 degree radius, and multiplying that by 2 to somehow increase its "resolution" only makes the rotation break. What critical piece of knowledge am I lacking here?
private bool mouseMoved(MouseEvent arg)
{
float RotateScale_CameraPitch = .001f;//mouse sensitivity
float RotateScale_PlayerTurn = .05f;//mouse sensitivity
MouseState_NativePtr s = arg.state;
if (arg.state.buttons == 2)
{
axleaxis = s.X.rel * RotateScale_PlayerTurn;
chat("____________________________________________________________");
nodes["orbit0"].Pitch(s.Y.rel * RotateScale_CameraPitch);
Mogre.Quaternion orient1 = control.Actor.GlobalOrientationQuaternion;
Mogre.Vector3 rkAxis = new Mogre.Vector3();
Degree rfAngle = new Degree();
orient1.ToRotationMatrix().ToAxisAngle(out rkAxis, out rfAngle);
//chat(rfAngle.ValueDegrees.ToString() + " | " + (s.X.rel * RotateScale_PlayerTurn).ToString());//0-180
orient2 = new Quaternion(new Radian(new Degree(rfAngle.ValueDegrees + (-s.X.rel * RotateScale_PlayerTurn))), new Mogre.Vector3(0, 1, 0));
control.Actor.GlobalOrientationQuaternion = orient2;
updateCam();
}
float mouseZ = (float)OgreWindow.g_m.MouseState.Z.rel * .1f;
//chat(mouseZ.ToString());
if (mouseZ > 0)
{
middleMouseState = middleMouseStates.scrollup;
middlemousetimer.reset();
middlemousetimer.start();
}
else if (mouseZ < 0)
{
middleMouseState = middleMouseStates.scrolldown;
middlemousetimer.reset();
middlemousetimer.start();
}
return true;
}