Returns square root of f
.
#pragma strict // Vector3.Distance and several other standard functions. function HypotenuseLength(sideALength: float, sideBLength: float) { return Mathf.Sqrt(sideALength * sideALength + sideBLength * sideBLength); }
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { // The formula made famous by Pythagoras, also used internally by // Vector3.Distance and several other standard functions. float HypotenuseLength(float sideALength, float sideBLength) { return Mathf.Sqrt(sideALength * sideALength + sideBLength * sideBLength); } }
Did you find this page useful? Please give it a rating: