Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool CBasePlayer::SetObserverTarget(CBaseEntity *target)
- {
- if ( !IsValidObserverTarget( target ) )
- return false;
- // set new target
- m_hObserverTarget.Set( target );
- // reset fov to default
- SetFOV( this, 0 );
- if ( m_iObserverMode == OBS_MODE_ROAMING )
- {
- Vector dir, end;
- Vector start = target->EyePosition();
- AngleVectors( target->EyeAngles(), &dir );
- VectorNormalize( dir );
- VectorMA( start, -64.0f, dir, end );
- Ray_t ray;
- ray.Init( start, end, VEC_DUCK_HULL_MIN , VEC_DUCK_HULL_MAX );
- trace_t tr;
- UTIL_TraceRay( ray, MASK_PLAYERSOLID, target, COLLISION_GROUP_PLAYER_MOVEMENT, &tr );
- JumptoPosition( tr.endpos, target->EyeAngles() );
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement