void Update() { var closeness = Warp.closenessFactor(transform.position, Facts.asteroidShakeDistance); material.color = new Color( Mathf.Lerp(1.0f, proximityColor.r, closeness), Mathf.Lerp(1.0f, proximityColor.g, closeness), Mathf.Lerp(1.0f, proximityColor.b, closeness) ); }
void Update() { var closeness = Warp.closenessFactor(transform.position, Facts.portalDisplayDistance); if (closeness == 0.0f) { portalTransform.gameObject.SetActive(false); return; } portalTransform.gameObject.SetActive(true); meshTransform.localScale = Vector3.Lerp(minimumScale, maximumScale, closeness); meshTransform.transform.position = WorldSphere.projectPoint(transform.position); cameraTransform.transform.position = Warp.warp(portalTransform.position, 0.0f); cameraTransform.transform.LookAt(DistanceFromCenter.center, Facts.up); meshTransform.transform.LookAt(DistanceFromCenter.center, Facts.up); meshTransform.Rotate(new Vector3(1.0f, 0.0f, 0.0f), 90.0f); }