bool _checkContact(FBBall ball, FBActor actor) { // TODO: if (ball.get3DPosition().y > actor.configuration.bodyHeight) { return(false); } if (ball.kicker == actor && actor.isKickingBall) { return(false); } ball.onCollided(actor); return(true); }
public bool checkBallCatchingWhenMoving(FBBall ball, out Fix64 weight) { weight = Fix64.Zero; if (!(m_currentState == Movement.instance || m_currentState == DefendMovement.instance)) { return(false); } //如果没有速度的情况下,不处理此种情况的拿球 if (particle.velocity == FixVector2.kZero) { return(false); } if (ball.get3DPosition().y > m_configuration.maxCatchingBallHeight) { return(false); } var s = this.configuration.catchingRadius; var d = m_particle.position.distance(ball.particlePosition); if (d > s) { return(false); } //jlx 2017.04.24-log:在配置角度(catchingAngle)内才能被捕获 var dir = (ball.particlePosition - m_particle.position).normalized; var dot = FixVector2.dot(direction, dir); if (dot <= m_configuration.catchingAngle) { return(false); } if (s != Fix64.Zero) { weight = Fix64.One - d / s; } return(true); }