-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Enjoy
Код:
/**
* Rotation
*/
void rotate(
float& angle,
user_cmd* cmd)
{
/**
*Get the local player, shouldnt be too hard
*/
auto local_player = get_local_player;
/**
*calculate the server time
*/
float server_time = local->tickbase()* globals->interval_per_tick;
/**
* set rotate_speed
*/
float rotate_speed = 300;
/**
* set rotate range (in degrees)
*/
float rotate_range = 180;
/**
* apply the rotation
*/
float yaw = fmod(static_cast<float>(server_time)* rotate_speed, rotate_range);
/**
* apply the rotation to the angle,
* normalize delta
*/
angle += 180 + ((rotate_range / 2) - static_cast<float>(yaw));
/**
* apply angle to player viewangles
*/
cmd->viewangles.y = angle;
}