mirror of
https://github.com/Q3Rally-Team/q3rally.git
synced 2024-11-22 03:51:23 +00:00
Make spectator observer camera rotate smoothly
This commit is contained in:
parent
56383666bc
commit
dc0fa02eb3
2 changed files with 19 additions and 1 deletions
|
@ -712,7 +712,6 @@ static int CG_CalcViewValues( void ) {
|
||||||
{
|
{
|
||||||
vec3_t forward, right, up;
|
vec3_t forward, right, up;
|
||||||
|
|
||||||
VectorCopy( ps->viewangles, cg.refdefViewAngles );
|
|
||||||
/*
|
/*
|
||||||
if (!cg_paused.integer){
|
if (!cg_paused.integer){
|
||||||
Com_Printf("pitch: angles2 %f, damage %f, viewangle %f\n", cg.predictedPlayerEntity.currentState.angles2[PITCH], BYTE2ANGLE(ps->damagePitch), ps->viewangles[PITCH]);
|
Com_Printf("pitch: angles2 %f, damage %f, viewangle %f\n", cg.predictedPlayerEntity.currentState.angles2[PITCH], BYTE2ANGLE(ps->damagePitch), ps->viewangles[PITCH]);
|
||||||
|
@ -720,6 +719,21 @@ static int CG_CalcViewValues( void ) {
|
||||||
Com_Printf( "origin: %f %f %f, vel %f %f %f\n", cg.refdef.vieworg[0], cg.refdef.vieworg[1], cg.refdef.vieworg[2], ps->velocity[0], ps->velocity[1], ps->velocity[2] );
|
Com_Printf( "origin: %f %f %f, vel %f %f %f\n", cg.refdef.vieworg[0], cg.refdef.vieworg[1], cg.refdef.vieworg[2], ps->velocity[0], ps->velocity[1], ps->velocity[2] );
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if ( ps->persistant[PERS_ATTACKER] >= 0 && ps->persistant[PERS_ATTACKER] < MAX_CLIENTS
|
||||||
|
&& cg_entities[ps->persistant[PERS_ATTACKER]].currentValid ) {
|
||||||
|
centity_t *cent;
|
||||||
|
vec3_t delta, angles;
|
||||||
|
|
||||||
|
cent = &cg_entities[ps->persistant[PERS_ATTACKER]];
|
||||||
|
|
||||||
|
VectorSubtract(cent->lerpOrigin, ps->origin, delta);
|
||||||
|
vectoangles(delta, angles);
|
||||||
|
VectorCopy(angles, cg.refdefViewAngles);
|
||||||
|
} else {
|
||||||
|
VectorCopy( ps->viewangles, cg.refdefViewAngles );
|
||||||
|
}
|
||||||
|
|
||||||
AngleVectors(cg.refdefViewAngles, forward, right, up);
|
AngleVectors(cg.refdefViewAngles, forward, right, up);
|
||||||
VectorMA(cg.refdef.vieworg, ps->velocity[0], forward, cg.refdef.vieworg);
|
VectorMA(cg.refdef.vieworg, ps->velocity[0], forward, cg.refdef.vieworg);
|
||||||
VectorMA(cg.refdef.vieworg, ps->velocity[1], right, cg.refdef.vieworg);
|
VectorMA(cg.refdef.vieworg, ps->velocity[1], right, cg.refdef.vieworg);
|
||||||
|
|
|
@ -1742,6 +1742,8 @@ void SpectatorClientEndFrame( gentity_t *ent ) {
|
||||||
clientNum = level.follow2;
|
clientNum = level.follow2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ent->client->ps.persistant[PERS_ATTACKER] = -1;
|
||||||
|
|
||||||
if ( clientNum >= 0 ) {
|
if ( clientNum >= 0 ) {
|
||||||
// ent->client->ps.clientNum = clientNum;
|
// ent->client->ps.clientNum = clientNum;
|
||||||
cl = &level.clients[ clientNum ];
|
cl = &level.clients[ clientNum ];
|
||||||
|
@ -1754,6 +1756,8 @@ void SpectatorClientEndFrame( gentity_t *ent ) {
|
||||||
VectorSubtract(cl->ps.origin, ent->client->ps.origin, delta);
|
VectorSubtract(cl->ps.origin, ent->client->ps.origin, delta);
|
||||||
vectoangles(delta, angles);
|
vectoangles(delta, angles);
|
||||||
VectorCopy(angles, ent->client->ps.viewangles);
|
VectorCopy(angles, ent->client->ps.viewangles);
|
||||||
|
|
||||||
|
ent->client->ps.persistant[PERS_ATTACKER] = clientNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorClear(ent->client->ps.velocity);
|
VectorClear(ent->client->ps.velocity);
|
||||||
|
|
Loading…
Reference in a new issue