private void Start() { vb = GetComponent <VehicleBase>(); if (vb != null) { ObjectHeightOffset = vb.ObjectHeight; } }
protected virtual void Start() { rb = GetComponent<Rigidbody>(); vehicle = GetComponent<VehicleBase>(); if (rb) { startDrag = rb.drag; startAngularDrag = rb.angularDrag; rb.mass = mass; } }
protected virtual void HandleControlTarget() { if (controlTarget != previousControlTarget) { //new controlTarget has been set- update everyone if (previousControlTarget) { previousControlTarget.RemoveController(this); } controlTarget.SetController(this); previousControlTarget = controlTarget; } }
// Update is called once per frame void Update() { vehicle = controller.ControlTarget; if (vehicle != null) { LatLon geoPos = vehicle.GetGeoPos(); float TerrainHeight = GeoCoord.GetTerrainElevation(geoPos); tmpPosition.text = ("LatLonHeight: (" + Mathf.Round(geoPos.lat * 10f) / 10f + "," + Mathf.Round(geoPos.lon * 10f) / 10f + "," + Mathf.Round(TerrainHeight * 100f) / 100f) + ")"; /* * tmpGravity.text = ("Gravity: " + Mathf.Round(vehicle.GetGravitationalForce() * 100f) / 100f); * * tmpHeight.text = ("Height: " + Mathf.Round(vehicle.GetHeight() * 100f) / 100f); * * tmpTemp.text = ("Temp: " + Mathf.Round(vehicle.GetAirDensity() * 1000f) / 1000f); * * tmpLift.text = ("Lift: " + Mathf.Round(vehicle.GetLiftForce() * 100f) / 100f); */ } }
// Use this for initialization void Start() { rb = GetComponent <Rigidbody>(); vb = GetComponent <VehicleBase>(); }