Example #1
0
        private void UpdateOnPlaneWhenExit(Collider other)
        {
            MonoPlane plane = other.GetComponent <MonoPlane>();

            if (plane != null)
            {
                onPlane = null;
            }
        }
Example #2
0
 private void UpdateOnPlaneWhenStay(Collider other)
 {
     onPlane = other.GetComponent <MonoPlane>();
 }
Example #3
0
        //void CorrectPosition(bool isColliding, Vector3 hitPoint, MonoPlane plane)
        //{
        //    if (isColliding == false)
        //        return;

        //    Vector3 correctedPosition = plane.CorrectedPosition(this);
        //    Debug.DrawLine(hitPoint, correctedPosition, Color.green);

        //    transform.position = correctedPosition;
        //}


        /// <summary>
        /// Assuming the initial velocity is 0
        /// </summary>
        /// <returns></returns>
        public float VelocityOnGround(MonoPlane plane)
        {
            return(Mathf.Sqrt(2f * Physics.gravity.magnitude * (transform.position.y - plane.transform.position.y)));
        }