void shake() { //increment perlin 'cursor' perlinX += shakeSpeed * Time.deltaTime; perlinY += shakeSpeed * Time.deltaTime; perlinZ += shakeSpeed * Time.deltaTime; //remap to -1 to 1 and amplify according to shake quantity float x = Nox.remap(Mathf.PerlinNoise(perlinX, 0), 0f, 1f, -1f, 1f) * shakeQuantity; float y = Nox.remap(Mathf.PerlinNoise(perlinY, 0), 0f, 1f, -1f, 1f) * shakeQuantity; float z = Nox.remap(Mathf.PerlinNoise(perlinZ, 0), 0f, 1f, -1f, 1f) * shakeQuantity; //use player speed as subtraction to shake speed modifier //the faster the player moves, the less camera shake there is playerSpeed = player.GetComponent <PlayerMove>().getSpeed(); float shakeSpeedModifier = 1f - (playerSpeed * 0.005f); if (shakeSpeedModifier < 0) { shakeSpeedModifier = 0; } //apply perlin noise as rotation transform.localEulerAngles = new Vector3(transform.localEulerAngles.x + (x * shakeSpeedModifier), transform.localEulerAngles.y + (y * shakeSpeedModifier), transform.localEulerAngles.z + (z * shakeSpeedModifier)); }
void setFOV() { if (GameObject.Find("Camera").GetComponent <SunClick>().transitioning == null) { if (!flying) { targetFOV = Nox.ease(targetFOV, Nox.remap(targetSpeed, walkSpeed, sprintSpeed, defaultFOV, fastFOV), FOVease); } camComponent.fieldOfView = targetFOV; } }
void setDistance() { targetDistance = Nox.remap(playerScript.targetFOV, playerScript.defaultFOV, playerScript.fastFOV, distanceFromCamera, minDistanceFromCamera); }