public void UpdateSimulation() { //SimInput = new VehicleSimulationInput(); SimInput = default(VehicleSimulationInput); SimInput.bHasData = true; if (hasDriver) { //SimInput.bOnGround = helicoCtrl.IsOnGround; SimInput.bOnGround = true; DebugMsg("IsOnGround = " + SimInput.bOnGround.ToString()); SimInput.velocity = rigidBody.velocity; DebugMsg("RigidBody velocity: pos = " + rigidBody.velocity.ToString("0.0000") + " | rot = " + rigidBody.angularVelocity.ToString("0.0000")); //SimInput.bAccelerate = IsMoving(); SimInput.bAccelerate = !helicoCtrl.IsOnGround; DebugMsg("IsMoving = " + SimInput.bAccelerate.ToString()); SimInput.steering = rigidBody.angularVelocity.y; DebugMsg("SimInput.steering = " + SimInput.steering.ToString("0.0000")); //this.vehicle.UpdateSimulation(SimInput); } else { SimInput.bOnGround = true; SimInput.velocity = Vector3.zero; SimInput.bAccelerate = false; this.vehicle.UpdateSimulation(SimInput); } }
public override void Init(int _entityClass) { base.Init(_entityClass); Transform engine_splash = null; Transform[] transforms = this.GetComponentsInChildren <Transform>(true); foreach (Transform transform in transforms) { if (transform.name == "engine_splash") { engine_splash = transform; } } if (engine_splash != null) { DebugMsg("Found engine_splash Transform"); particleEmitter = engine_splash.GetComponent <EllipsoidParticleEmitter>(); if (particleEmitter != null) { DebugMsg("Found EllipsoidParticleEmitter"); particleEmitter.emit = false; } } if (LZ_float_field != null) { maxSpeedBackup = (float)LZ_float_field.GetValue(this.vehicle); } if (GS_VehicleSimulationInput_field != null) { vsi = (VehicleSimulationInput)GS_VehicleSimulationInput_field.GetValue(this); } }