protected override void UpdateVehicles() { //enable/disable the gameobject according to distance var selfEntity = PlayerContext.flagSelfEntity; var vehicleEntities = Vehicles.GetEntities(); var vehicleCount = vehicleEntities.Length; var lodCullDistance = _sqrLodDistance; var physicsCullDistance = SqrPhysicsDistance; if (SharedConfig.DisableVehicleCull) { lodCullDistance = physicsCullDistance = float.MaxValue; } for (int i = 0; i < vehicleCount; ++i) { var vehicle = vehicleEntities[i]; var distance = SqrDistance(selfEntity, vehicle); var active = false; var lowLod = true; if (distance < lodCullDistance * LodDistanceDamper) { active = true; if (distance < physicsCullDistance * PhysicsDistanceDamper) { lowLod = false; } else if (distance < physicsCullDistance) { lowLod = vehicle.IsLowLod(); } } else if (distance < lodCullDistance) { active = vehicle.IsActiveSelf(); lowLod = vehicle.IsLowLod(); } SetActiveDelay(new ActiveSetting(vehicle, active, lowLod)); } }
protected override void UpdateVehicles() { //enable/disable the gameobject according to distance var selfEntity = PlayerContext.flagSelfEntity; var vehicleEntities = Vehicles.GetEntities(); var vehicleCount = vehicleEntities.Length; var lodCullDistance = _sqrLodDistance; var physicsCullDistance = SqrPhysicsDistance; if (SharedConfig.DisableVehicleCull) { lodCullDistance = physicsCullDistance = float.MaxValue; } for (int i = 0; i < vehicleCount; ++i) { var vehicle = vehicleEntities[i]; var distance = SqrDistance(selfEntity, vehicle); var active = false; var lowLod = true; if (distance < lodCullDistance * LodDistanceDamper) { active = true; if (distance < physicsCullDistance * PhysicsDistanceDamper) { lowLod = false; } else if (distance < physicsCullDistance) { lowLod = vehicle.IsLowLod(); } } else if (distance < lodCullDistance) { active = vehicle.IsActiveSelf(); lowLod = vehicle.IsLowLod(); } vehicle.SetActive(active); if (active) { if (_isPredictMode) { NotifyVehicleActive(vehicle); } vehicle.SetLodLevel(lowLod); } } if (!_isPredictMode) { if (selfEntity.IsOnVehicle()) { var vehicle = VehicleContext.GetEntityWithEntityKey(selfEntity.controlledVehicle.EntityKey); if (vehicle != null) { NotifyVehicleActive(vehicle); } } } }