static inline float vector2angel(cocos2d::Vec2 v)
{
    if (v.length() == 0) {
        return 0;
    }

    float pir = std::acos(v.x/v.length());
    if (v.y < 0) {
        pir = 2*3.1415926 - pir;
    }
    return  pir*(180.f/3.1415926);
}
void SteeringAgent::truncateSteeringForce(cocos2d::Vec2& force) const {

	if (force.length() > m_maxForce) {

		force.normalize();
		force *= m_maxForce;
	}

	if (force.length() > m_velocity.length()) {
		force = getForward() * m_maxForce;
	}
}
void SteeringAgent::truncateVelocity(cocos2d::Vec2& velocity) const {

	if (velocity.length() > m_maxSpeed) {
		
		velocity.normalize();
		velocity *= m_maxSpeed;
	}
}