Search Unity

The AR app without shadow In my phone

Discussion in 'AR/VR (XR) Discussion' started by WHU_XH, Jan 20, 2019.

  1. WHU_XH

    WHU_XH

    Joined:
    Aug 22, 2018
    Posts:
    1
    I am so happy for your coming. Then the problem is that I create a AR app,but it didn't show shadow in my phone.I found a solve on the Internet. It say I can attach the following program to the AR Camera.

    using UnityEngine;
    using System.Collections;
    using Vuforia;

    public class FixProjectionMatrix : MonoBehaviour, IVideoBackgroundEventHandler
    {
    private Camera[] mCameras;

    // Use this for initialization
    void Start()
    {
    mCameras = VuforiaBehaviour.Instance.GetComponentsInChildren<Camera>();
    VuforiaBehaviour.Instance.RegisterVideoBgEventHandler(this);
    }

    // Update is called once per frame
    void Update()
    {

    }

    public void OnVideoBackgroundConfigChanged()
    {
    foreach (var cam in mCameras)
    {
    var projMatrix = cam.projectionMatrix;
    for (int i = 0; i < 16; i++)
    {
    if (System.Math.Abs(projMatrix) < 1e-6)
    {
    projMatrix = 0.0f;
    }
    }
    cam.projectionMatrix = projMatrix;
    }
    }
    }


    But unity reports the errors:Type `Vuforia.VuforiaBehaviour' does not contain a definition for `RegisterVideoBgEventHandler' and no extension method `RegisterVideoBgEventHandler' of type `Vuforia.VuforiaBehaviour' could be found. Are you missing an assembly reference?
    Did I forget something?I am so Thanksgiving if you can answer my question.
     
    ahmed3dmind likes this.