// Update is called once per frame void Update() { if (vertical) { vertical.Move(1); } }
private void OnCollisionEnter(Collision collision) { if (!random) { return; } hit = true; float u1 = 1.0f - Random.value; //uniform(0,1] random doubles float u2 = 1.0f - Random.value; float randStdNormal = Mathf.Sqrt(-2.0f * Mathf.Log(u1)) * Mathf.Sin(2.0f * Mathf.PI * u2); //random normal(0,1) float randNormal = 0.5f * randStdNormal; //random normal(mean,stdDev^2) if (verticalMove) { verticalMove.Move(randNormal); } if (horizontalMove) { horizontalMove.Move(randNormal); } }