UnityEngine.Quaternion.SetLookRotation(UnityEngine.Vector3, UnityEngine.Vector3)

Here are the examples of the csharp api UnityEngine.Quaternion.SetLookRotation(UnityEngine.Vector3, UnityEngine.Vector3) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

19 View Source File : OVRGazePointer.cs
License : MIT License
Project Creator : Tobbse

public override void SetCursorStartDest(Vector3 _, Vector3 pos, Vector3 normal)
    {
        transform.position = pos;

        if (!matchNormalOnPhysicsColliders) normal = rayTransform.forward;
        
        // Set the rotation to match the normal of the surface it's on.
        Quaternion newRot = transform.rotation;
        newRot.SetLookRotation(normal, rayTransform.up);
        transform.rotation = newRot;

        // record depth so that distance doesn't pop when pointer leaves an object
        depth = (rayTransform.position - pos).magnitude;

        //set scale based on depth
        currentScale = depth * depthScaleMultiplier;
        transform.localScale = new Vector3(currentScale, currentScale, currentScale);

        positionSetsThisFrame++;
        RequestShow();
    }

19 View Source File : OVRGazePointer.cs
License : MIT License
Project Creator : Tobbse

void LateUpdate()
    {
        // This happens after all Updates so we know that if positionSetsThisFrame is zero then nothing set the position this frame
        if (positionSetsThisFrame == 0)
        {
            // No geometry intersections, so gazing into space. Make the cursor face directly at the camera
            Quaternion newRot = transform.rotation;
            newRot.SetLookRotation(rayTransform.forward, rayTransform.up);
            transform.rotation = newRot;
        }

        if (gazeIcon != null)
        {
            Quaternion iconRotation = gazeIcon.rotation;
            iconRotation.SetLookRotation(transform.rotation * new Vector3(0, 0, 1));
            gazeIcon.rotation = iconRotation;
        }

		positionSetsThisFrame = 0;
    }

19 View Source File : OVRGazePointer.cs
License : MIT License
Project Creator : Tobbse

void LateUpdate()
    {
        // This happens after all Updates so we know that if positionSetsThisFrame is zero then nothing set the position this frame
        if (positionSetsThisFrame == 0)
        {
            // No geometry intersections, so gazing into space. Make the cursor face directly at the camera
            Quaternion newRot = transform.rotation;
            newRot.SetLookRotation(rayTransform.forward, rayTransform.up);
            transform.rotation = newRot;
        }

        if (gazeIcon != null)
        {
            Quaternion iconRotation = gazeIcon.rotation;
            iconRotation.SetLookRotation(transform.rotation * new Vector3(0, 0, 1));
            gazeIcon.rotation = iconRotation;
        }

		positionSetsThisFrame = 0;
    }