tackle.cpp
来自「robocup3d源化码 Nexus3D.tar.gz」· C++ 代码 · 共 34 行
CPP
34 行
/* |No|Copyright (C) 2005 Ferdowsi University*/#include "tackle.h"#include "global.h"bool Tackle::IsTackleNeeded() { float TRadious = 0.5;// Treatening Radious if (TheirPlayer[FieldInfo.NearestOpponent2(ball.pos)].dist2ball < TRadious) return false; return true;}bool Tackle::TryTackle(){ float RiskRadious = 0.7; float agentAngle = NormalizeAngle(Rad2Deg(atan2((ball.pos[1]-self.pos[1]),(ball.pos[0]-self.pos[0]))),-180.0); if(ball.pos[0] < -30 || self.dist2ball > RiskRadious || self.dist2ball > MyPlayer[FieldInfo.NearestTeammate2(ball.pos)].dist2ball || !IsTackleNeeded() || agentAngle > 75 || agentAngle < -75) return false; action_info.x = ball.pos[0] ; action_info.y = ball.pos[1] ; action_info.do_drive = true ; action_info.kick_angle = 45; action_info.kick_direction = agentAngle; action_info.kick_power = 100; action_info.do_kick = true; return true;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?