当前位置: 首页>>代码示例>>C++>>正文


C++ PlayerState::GetKickRate方法代码示例

本文整理汇总了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();
}
开发者ID:harshnisar,项目名称:WEFork,代码行数:26,代码来源:ActionEffector.cpp


注:本文中的PlayerState::GetKickRate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。