Control the viewangles via the client side


(DJ_Art) #1

Hello, I need to find 3 ways to control the client’s viewangles through the code: one for server side, one for bg side and one for the client side of the code.

As for the server side, there is a function called SetClientViewAngle, which works fine.

As for the bg side, I changed the above function to this:
{
VectorCopy(pm->ps->viewangles, myvector);

myvector[PITCH] = bla bla;
myvector[YAW] = bla bla;
myvector[ROLL] = bla bla;

// set the delta angle
for (i=0 ; i<3 ; i++) {

cmdAngle = ANGLE2SHORT(myvector[i]);
pm->ps->delta_angles[i] = cmdAngle - pm->cmd.angles[i];
}

VectorCopy(myvector, pm->ps->viewangles);

}

This one also works fine! :smile:

So, now, I want to do the same thing in the client side code.

My biggest problems are:
pm->ps->viewangles
pm->ps->delta_angles
and pm->cmd.angles

I replaced pm->ps->viewangles and pm->ps->delta_angles with cg.predictedPlayerState.viewangles and cg.predictedPlayerState.delta_angles, but I’m stuck with pm->cmd.angles. I can’t find a correct replacement for this one, and right now the above function (without cmd.angles) doesn’t work.

Any ideas ?

TIA! :smile:


(fretn) #2

cg.refdefViewAngles[PITCH]
cg.refdefViewAngles[YAW]
cg.refdef.vieworg

maybe these will help, I found them in cg_view.c => static void CG_OffsetThirdPersonView(void);

fretn