3 protected const float MIN_SPEED_MPS = 0.5;
4 protected const float MIN_SPEED_RADS = 0.5;
5 protected BaseVehicle m_vehicle;
6 protected VehicleHelicopterSimulation m_heliSimulation;
8 protected override bool TestFunction(AIAgent agent, IEntity controlled)
14 IEntity parent = controlled;
15 BaseVehicle vehicle = BaseVehicle.Cast(controlled);
16 bool isMoving, isRotating, isInAir;
18 while (vehicle ==
null && parent !=
null)
20 parent = parent.GetParent();
22 vehicle = BaseVehicle.Cast(parent);
28 if (m_vehicle != vehicle)
31 m_heliSimulation = VehicleHelicopterSimulation.Cast(vehicle.FindComponent(VehicleHelicopterSimulation));
34 Physics ph = controlled.GetPhysics();
35 if (!ph || !ph.IsActive())
38 isMoving = ph.GetVelocity().Length() > MIN_SPEED_MPS;
39 isRotating = ph.GetAngularVelocity().Length() > MIN_SPEED_RADS;
43 vector positionActual;
44 positionActual = vehicle.GetOrigin();
45 isInAir = !m_heliSimulation.HasAnyGroundContact();
46 return isInAir || isMoving || isRotating;
48 return isMoving || isRotating;