2 s164828378 s164828378 于 2016.03.30 17:35 提问

急!unity导入vuforia包后出现CS1061错误,求大神帮忙看看!

Assets/Vuforia/Scripts/Utilities/VRIntegrationHelper.cs(94,43): error CS1061: Type object' does not contain a definition forApplyCorrectedProjectionMatrix' and no extension method ApplyCorrectedProjectionMatrix' of typeobject' could be found (are you missing a using directive or an assembly reference?)

3个回答

caozhy
caozhy   Ds   Rxr 2016.03.30 23:07

贴出你的代码,很可能是你忘记调用方法加上括号了,方法名写错了,或者你的类型用错了。

s164828378
s164828378 已贴代码。。求大神帮忙
2 年多之前 回复
s164828378
s164828378   2016.03.31 21:53

using System;
using UnityEngine;

using Vuforia;

public class VRIntegrationHelper : MonoBehaviour
{
private static Matrix4x4 mLeftCameraMatrixOriginal;
private static Matrix4x4 mRightCameraMatrixOriginal;

private static Camera mLeftCamera;
private static Camera mRightCamera;

private static HideExcessAreaAbstractBehaviour mLeftExcessAreaBehaviour;
private static HideExcessAreaAbstractBehaviour mRightExcessAreaBehaviour;

private static Rect mLeftCameraPixelRect;
private static Rect mRightCameraPixelRect;

private static bool mLeftCameraDataAcquired = false;
private static bool mRightCameraDataAcquired = false;

public bool IsLeft;
public Transform TrackableParent;

void Awake()
{
    GetComponent<Camera>().fieldOfView = 90f;
}

void Start()
{
    VuforiaBehaviour.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted);//报错
}

void OnVuforiaStarted()
{
    mLeftCamera = DigitalEyewearBehaviour.Instance.PrimaryCamera;
    mRightCamera = DigitalEyewearBehaviour.Instance.SecondaryCamera;

    mLeftExcessAreaBehaviour = mLeftCamera.GetComponent<HideExcessAreaAbstractBehaviour>();
    mRightExcessAreaBehaviour = mRightCamera.GetComponent<HideExcessAreaAbstractBehaviour>();
}

void LateUpdate()
{
    // to this only once per frame, not for both cameras
    if (IsLeft)
    {
        if (mLeftCameraDataAcquired && mRightCameraDataAcquired)
        {
            // make sure the central anchor point is set to the latest head tracking pose:
            DigitalEyewearBehaviour.Instance.CentralAnchorPoint.localRotation = mLeftCamera.transform.localRotation;
            DigitalEyewearBehaviour.Instance.CentralAnchorPoint.localPosition = mLeftCamera.transform.localPosition;

            // temporarily set the primary and secondary cameras to their offset position and set the pixelrect they will have for rendering
            Vector3 localPosLeftCam = mLeftCamera.transform.localPosition;
            Rect leftCamPixelRect = mLeftCamera.pixelRect;
            Vector3 leftCamOffset = mLeftCamera.transform.right.normalized * mLeftCamera.stereoSeparation * -0.5f;
            mLeftCamera.transform.position = mLeftCamera.transform.position + leftCamOffset;
            mLeftCamera.pixelRect = mLeftCameraPixelRect;

            Vector3 localPosRightCam = mRightCamera.transform.localPosition;
            Rect rightCamPixelRect = mRightCamera.pixelRect;
            Vector3 rightCamOffset = mRightCamera.transform.right.normalized * mRightCamera.stereoSeparation * 0.5f;
            mRightCamera.transform.position = mRightCamera.transform.position + rightCamOffset;
            mRightCamera.pixelRect = mRightCameraPixelRect;

            BackgroundPlaneBehaviour bgPlane = mLeftCamera.GetComponentInChildren<BackgroundPlaneBehaviour>();
            bgPlane.BackgroundOffset = mLeftCamera.transform.position - DigitalEyewearBehaviour.Instance.CentralAnchorPoint.position;

            mLeftExcessAreaBehaviour.PlaneOffset = mLeftCamera.transform.position - DigitalEyewearBehaviour.Instance.CentralAnchorPoint.position;
            mRightExcessAreaBehaviour.PlaneOffset = mRightCamera.transform.position - DigitalEyewearBehaviour.Instance.CentralAnchorPoint.position;

            if (TrackableParent != null)
                TrackableParent.localPosition = Vector3.zero;

            // update Vuforia explicitly
            VuforiaBehaviour.Instance.UpdateState(false, true);//报错

            if (TrackableParent != null)
                TrackableParent.position += bgPlane.BackgroundOffset;

            // set the projection matrices for skewing
            VuforiaBehaviour.Instance.ApplyCorrectedProjectionMatrix(mLeftCameraMatrixOriginal, true);//报错
            VuforiaBehaviour.Instance.ApplyCorrectedProjectionMatrix(mRightCameraMatrixOriginal, false);//报错

#if !(UNITY_5_2 || UNITY_5_1 || UNITY_5_0) // UNITY_5_3 and above

            // read back the projection matrices set by Vuforia and set them to the stereo cameras
            // not sure if the matrices would automatically propagate between the left and right, so setting it explicitly twice
            mLeftCamera.SetStereoProjectionMatrices(mLeftCamera.projectionMatrix, mRightCamera.projectionMatrix);
            mRightCamera.SetStereoProjectionMatrices(mLeftCamera.projectionMatrix, mRightCamera.projectionMatrix);

#endif
// reset the left camera
mLeftCamera.transform.localPosition = localPosLeftCam;
mLeftCamera.pixelRect = leftCamPixelRect;

            // reset the position of the right camera
            mRightCamera.transform.localPosition = localPosRightCam;
            mRightCamera.pixelRect = rightCamPixelRect;
        }
    }
}

// OnPreRender is called once per camera each frame
void OnPreRender()
{
    // on pre render is where projection matrix and pixel rect are set up correctly (for each camera individually)
    // so we use this to acquire this data.
    if (IsLeft && !mLeftCameraDataAcquired)
    {
        mLeftCameraMatrixOriginal = mLeftCamera.projectionMatrix;
        mLeftCameraPixelRect = mLeftCamera.pixelRect;
        mLeftCameraDataAcquired = true;
    }
    else if (!mRightCameraDataAcquired)
    {
        mRightCameraMatrixOriginal = mRightCamera.projectionMatrix;
        mRightCameraPixelRect = mRightCamera.pixelRect;
        mRightCameraDataAcquired = true;

    }
}

}
//inatance后面老报错,我没有添加实例么??还是没有传递什么参数??报CS1061的错误。。。。。

hyp_no_sis
hyp_no_sis   2016.04.03 15:20

是你的插件包所需的unity版本,跟你现有的导入插件的unity版本不匹配吧。

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
Vuforia SDK---- AR开发vuforia 问题总结
在vuforia 开发中经常会遇到一些常见的问题,开一帖专门记录一下问题。 2015.5.30 在qq群看到有人问vuforia sdk对焦问题?在vuforia中是支持自动对焦的,详细在之前博客文章中有叙述。 对焦问题解决 vuforia 对焦解决方案
CS1061号错误是什么
原文地址:https://support.unity3d.com/hc/en-us/articles/206193836-What-is-CS1061-症状当尝试进入Play模式时,我得到了如下的错误: error CS1061: Type `__’ does not contain a definition for `__’ and no extension method `__’ of ty
关于Vuforia导入数据包后不显示图片的解决方法
亲爱哒小伙伴们~ 你们在用vuforia-unity-6-2-10这个版本的SDK是不是会出现一个问题: 导入的数据包也勾选了加载,该做的都做了,但是imagetarget上就是一片空白。。。 这个问题折磨了我半天~ 终于,我发现了这个。。。 本地数据包的图片形状竟然是cube类型。。。 于是乎,我就把形状改为了2D。 就这样问题就解决了。 感觉自己棒棒哒
unity for Vuforia5.5.9 遇到的问题
1、win7 64位在Unity3D 5.3.3 64位导入Vuforia5.5.9时候会出现一个问题
ELM——HOG
代码有问题 出现内存访问错误 求大神帮忙修改
基于 vuforia + unity + android studio 的AR开发中遇到的问题
1、如果退出这个activity,会把整个application都退出在配置文件里, 继承UnityPlayerActivity的activity 加上android:process 属性即可<activity android:name=".Main2Activity" android:process=":Main2Activity" />
Vuforia自学笔记(一)生成识别图的unity开发包
现在AR技术已经日趋成熟了,我学习了一段时间的AR开发,将自己开发过程及一些经验分享出来,本文将分享使用6-2-6版本的Vuforia开发安卓应用的一些经验,希望可以与各位AR技术的爱好者共同进步,若其中有错误的地方还望各位博友不吝赐教。
Unity_AR制作_80
1.生成扫描图片https://developer.vuforia.com/ 注册账号(注意密码必须有大小写和数字,否则注册不成功)生成识别图的unity包。 然后配置下图 创建Database 进入Database 添加Target 设置完成后点击Add 识别图生成好了,点选之后选择下载 下载 ARTest.unitypackage,导入Unity
Unity2017版—使用Vuforia 6.2.10插件 出现问题的解决方案
前提: vuforia6.2.10较之前有些许变化。下面来看一下。假如你已经在Unity中导入过了Vuforia6.2.10,并且配置完毕(包括申请appkey创建database等)。一、APP KEY的添加位置 配置: 选中ARCamera 点击右边Inspector编译面板第一个脚本VuforiaBehavior下面的Open Vuforia configuration2. 会进入
Unty4.7 导入 NGUI3.8.2报错解决
Unity4.7 导入某个版本的NGUI时,假如出现“Assets/NGUI/Scripts/Interaction/UIPopupList.cs(956,45): error CS1061: Type `UnityEngine.BoxCollider2D' does not contain a definition for `offset' and no extension method `of