Ejemplo n.º 1
0
    void OnTriggerEnter(Collider co)
    {
        if (co.tag == "Ladder" &&
            !mountUsage.IsMounted() &&
            state != MoveState.CLIMBING) // only do initialization once
        {
            state          = MoveState.CLIMBING;
            ladderCollider = co;

            // make player look directly at ladder forward. but we also initialize
            // freelook manually already to overwrite the initial rotation, so
            // that in the end, the camera keeps looking at the same angle even
            // though we did modify transform.forward.
            // note: even though we set the rotation perfectly here, there's
            //       still one frame where it seems to interpolate between the
            //       new and the old rotation, which causes 1 odd camera frame.
            //       this could be avoided by overwriting transform.forward once
            //       more in LateUpdate.
            look.InitializeFreeLook();
            Quaternion original = transform.rotation;
            transform.forward = co.transform.forward;
        }

        // touching water? then set water collider
        if (co.tag == "Water")
        {
            waterCollider = co;
        }
    }
Ejemplo n.º 2
0
 void EnterLadder()
 {
     if (isLocalPlayer)
     {
         look.InitializeFreeLook();
         transform.forward = ladderCollider.transform.forward;
     }
 }