Ejemplo n.º 1
0
        protected override void DoDriverDeath()
        {
            // just enable physics for this vehicle
            SetKinematic(false);

            // set its velocity
            VehicleRigidbody.velocity = velocity;

            // and add random torque
            float maxTorque = deathTorque;
            float t         = Random.Range(-maxTorque, maxTorque);

            VehicleRigidbody.AddTorque(t * VehicleRigidbody.mass * transform.up, ForceMode.Impulse);
        }
Ejemplo n.º 2
0
        protected override void DoDriverDeath()
        {
            // just enable physics for this vehicle
            SetKinematic(false);

            // set its velocity
            VehicleRigidbody.velocity = velocity;

            // and add random torque
            const float maxTorqueZ = 70;

            const float minTorqueY = -30;
            const float maxTorqueY = 50;

            float z = Random.Range(-maxTorqueZ, maxTorqueZ);
            float y = -Random.Range(minTorqueY, maxTorqueY);

            float   mass   = VehicleRigidbody.mass;
            Vector3 torque =
                z * mass * transform.forward +
                y * mass * transform.right;

            VehicleRigidbody.AddTorque(torque, ForceMode.Impulse);
        }