本文整理汇总了C++中PlayerState::GetKickRate方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerState::GetKickRate方法的具体用法?C++ PlayerState::GetKickRate怎么用?C++ PlayerState::GetKickRate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerState
的用法示例。
在下文中一共展示了PlayerState::GetKickRate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ComputeInfoAfterKick
/**
* 通过传入kick的参数,计算kick后球的位置和速度
* Calculate ball position and velocity after a kick action.
* \param kick_power.
* \param kick_angle.
* \param player_state state of the player who is performing kick.
* \param ball_state ball state before the kick action is performed.
* \param ball_pos will be set to ball position after kick.
* \param ball_vel will be set to ball velocity after kick.
* \param is_self if the action is performed by the agent this process represents.
*/
void ActionEffector::ComputeInfoAfterKick(const double kick_power, const double kick_angle,
const PlayerState &player_state, const BallState &ball_state, Vector &ball_pos, Vector &ball_vel, bool is_self)
{
double power = GetNormalizeKickPower(kick_power);
double dir = GetNormalizeMoment(kick_angle);
Vector ball_2_player = (ball_state.GetPos() - player_state.GetPos()).Rotate(-player_state.GetBodyDir());
double eff_power = power *
(is_self ? player_state.GetKickRate() : GetKickRate(ball_2_player, player_state.GetPlayerType()));
Vector accel = Polar2Vector(eff_power, player_state.GetBodyDir() + dir);
ball_vel = ball_state.GetVel() + accel;
ball_pos = ball_state.GetPos() + ball_vel;
ball_vel *= ServerParam::instance().ballDecay();
}