Thanks for the reply Minh. I'll try that when I get home tonight. That should shed some light on what is happening in VectorAngles().
Thanks! On Thu, Mar 1, 2012 at 9:55 AM, Minh <minh...@telus.net> wrote: > You can try spitting out the results to a file so you can observe the > hitch more closely. > Look for a function called COM_Log > > COM_Log ( "viewangle_hitch.txt", "%.2f %.2f %.2f \n", viewangles.x, > viewangles.y, viewangles.z ); > > > On 3/1/2012 3:55 AM, Craig Louie wrote: > > Thanks for the reply Saul. I hadn't thought of disabling prediction. I > just gave it a shot. I changed to "engine->ClientCmd( "cl_predict 0" );" in > cdll_client_int.cpp. With another test, the unsmooth rotation when looking > straight up/down still occurs. > > My main theories at this point: > 1) Something is occurring in VectorAngles(vec_for_out, vec_up_out, > viewangles) to cause this. VectorAngles() might not produce straight > up/down Euler angles properly - choking because of aliasing perhaps? This > is a big guess because I don't know the inner workings of VectorAngles(). > 2) There is some code somewhere else that is conflicting with the full, > unclamped rotation I've implemented. I've tried to remove all instances of > pitch clamping, for example. But I may have missed something. Also, it's > possible mouse rotation is somehow conflicting with my changes to joystick > rotation. > > Here's a video of the issue I'm seeing. It happens a few times in the > video. You'll see it happen the first time at about 11 seconds in when the > text on the floor twists/shakes. > http://www.youtube.com/watch?v=PLN641Qsn08 > > Thanks! > > > > On Wed, Feb 29, 2012 at 11:34 PM, Saul Rennison > <saul.renni...@gmail.com>wrote: > >> The hitching is most likely something trying to revert your angle changes >> (I.e. in prediction). Have you tried disabling prediction? >> >> >> On Thursday, March 1, 2012, Craig Louie wrote: >> >>> Hello Coders, >>> >>> I'm trying to create a space flight combat game with the Source SDK. >>> Currently, I am trying to achieve rotation around the player's local axes >>> for airplane-like pitch, yaw and roll. Below is the code I'm using to try >>> to implement full 3D rotation. I'm running into a problem where the >>> player's view twists and hitches unsmoothly when the player looks straight >>> up or straight down. I think this may be because of the inherent problem of >>> aliasing/Gimbal-lock when using Euler angles. Any advise? >>> >>> //######################################### >>> //Take the Euler angles for the player's orientation (viewangles) and >>> convert them to vectors. >>> Vector vec_for, vec_rt, vec_up, vec_for_out, vec_rt_out, vec_up_out; >>> AngleVectors(viewangles, &vec_for, &vec_rt, &vec_up); >>> >>> //Take the resulting vectors and the desired rotation amounts and >>> convert them to Quaternions. >>> Quaternion turn_q, look_q, roll_q; >>> // NOTE: Assumes axis is a unit vector, non-unit vectors will bias the >>> resulting rotation angle (but not the axis) >>> VectorNormalize(vec_up); >>> AxisAngleQuaternion(vec_up, turn_angle, turn_q); >>> >>> VectorNormalize(vec_rt); >>> AxisAngleQuaternion(vec_rt, look_angle, look_q); >>> >>> VectorNormalize(vec_for); >>> AxisAngleQuaternion(vec_for, roll_angle, roll_q); >>> >>> //Convert the quaternions to matrices. >>> matrix3x4_t xform0, xform1, xform2; >>> QuaternionMatrix(turn_q, xform0); >>> QuaternionMatrix(look_q, xform1); >>> QuaternionMatrix(roll_q, xform2); >>> >>> //Combine matrices. >>> matrix3x4_t xformA, xformB; >>> MatrixMultiply(xform0, xform1, xformA); >>> MatrixMultiply(xformA, xform2, xformB); >>> >>> //Rotate the vectors with our combined rotation matrix. >>> VectorRotate(vec_for, xformB, vec_for_out); >>> VectorRotate(vec_rt, xformB, vec_rt_out); >>> VectorRotate(vec_up, xformB, vec_up_out); >>> >>> //Determine the new viewangles based on our rotated vectors. >>> VectorAngles(vec_for_out, vec_up_out, viewangles); >>> //######################################### >>> >>> I put this code into in_joystick.cpp in the JoyStickMove( float >>> frametime, CUserCmd *cmd ) function. >>> >>> >>> Thanks! >>> >>> >>> >> >> -- >> >> >> Kind regards, >> *Saul Rennison* >> >> _______________________________________________ >> To unsubscribe, edit your list preferences, or view the list archives, >> please visit: >> https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders >> >> >> > > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, please > visit:https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders > > > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders > > >
_______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders