예제 #1
0
 // Update is called once per frame
 void Update()
 {
     if (carSphere == null)
     {
         carSphere = PlayerController.i.controlling.GetComponent <CarController>().carSphere;
     }
     cam.fieldOfView = Mathf.Lerp(cam.fieldOfView, startFOV + (carSphere.XZVelocityMagnitude * fovVelocityFac), Time.deltaTime * smooth);
 }
예제 #2
0
    void Update()
    {
        if (carSphere == null)
        {
            carSphere = PlayerController.i.controlling.GetComponent <CarController>().carSphere;
        }
        float speed = carSphere.XZVelocityMagnitude / speedDivider;

        animator.SetFloat("Speed", Mathf.Lerp(animator.GetFloat("Speed"), speed, smooth * Time.deltaTime));
    }
        private CarBalltreeMeshes CreateBalltreeMeshes(CRBalltreeAsset btAsset)
        {
            CarBalltreeMeshes btMeshes = new CarBalltreeMeshes();

            CarSphere[] arrSphere      = btAsset.LeafSpheres;
            int         arrSphere_size = arrSphere.Length;

            for (uint i = 0; i < arrSphere_size; i++)
            {
                CarSphere sphere = arrSphere[i];
                btMeshes.AddSphere(CarColor.ColorBasic42(i), sphere.center_, sphere.radius_);
            }

            btMeshes.FinishAddingSpheres();
            return(btMeshes);
        }
예제 #4
0
    // Update is called once per frame
    void Update()
    {
        if (carSphere == null)
        {
            carSphere = PlayerController.i.controlling.GetComponent <CarController>().carSphere;
        }

        // Needle
        float targetNeedleRotation = (carSphere.XZVelocityMagnitude / maxVelocity) * (needleMaxRot - needleMinRot) + needleMinRot;

        needle.localRotation = Quaternion.Lerp(needle.localRotation, Quaternion.Euler(needle.localEulerAngles.x, targetNeedleRotation, needle.localEulerAngles.z), Time.deltaTime * needleSmooth);

        // Body
        float targetBodyRotation = (carSphere.XZVelocityMagnitude / maxVelocity) * (bodyMaxRot - bodyMinRot) + bodyMinRot;

        transform.localRotation = Quaternion.Lerp(transform.localRotation, Quaternion.Euler(targetBodyRotation, transform.localEulerAngles.y, transform.localEulerAngles.z), Time.deltaTime * bodySmooth);
    }
예제 #5
0
 protected override void OnControllableChange(PlayerControllable controllable)
 {
     staticOffset = controllable.cameraStaticOffset;
     carSphere    = controllable.GetComponent <CarController>().carSphere;
 }