使用强制转换 3D 错误 1046:矩阵 3D 是什么意思



我正在尝试在闪存中使用 CAST3D,当我执行代码时,它给了我这个错误 1046:找不到类型或不是编译时常量:Matrix3D。当我单击编译器错误时,它会将我带到CAST3D的actionScript,它是这样的:

public function get local(): Matrix3D { return this.geomgroup.transform; }

我已经在闪存中安装了library.swc文件。我是闪光灯的新手。这个问题有什么解决方案吗?多谢阿德里安·德·巴罗

public function blenderModel() 
    {
        setup3DScene();
    }
private function setup3DScene(): void
    {
        this.setupSandy();
        this.setupCast3D();
        this.setupControls();
        this.loadData();
        this.addEventListener(Event.ENTER_FRAME, this.handleEnterFrame);    
    }
    /**
     * initial setup for Sandy3D.
     */     
    public function setupSandy(): void
    {       
     // We create the camera
         camera = new Camera3D( 600, 400 );
         camera.near = 1;
         // We create the "group" that is the tree of all the visible objects
         var root:Group = new Group();
         // We create a Scene and we add the camera and the objects tree 
         scene = new Scene3D( "scene", this, camera, root );             
         scene.light = new Light3D(new Vector(0,0,1),100);
    }
    /**
     * initial setup for Cast3D.
     */     
    public function setupCast3D(): void
    {       
                    this.loaded = false;
        this.animator = new Cast3d(this.scene, this.camera);
        this.animator.animationType = Cast3d.ANIMATION_TYPE_BYFRAME; //  ANIMATION_TYPE_REAL; //
        this.animator.fps = 22;
        this.animator.autoRewind = false;                       
    }
    /**
     *  Function setups visual animation control 
我不知道

这个库,从文档的简要看来看,我不是100%清楚它如何与Papervision3D或Sandy3D交互。但是,教程页面在单个 Cast3D swc 的下载链接旁边列出了以下要求:

  • 使用渲染引擎 Sandy3D 构建的 Flex 库 cast3d.swc 代码或纸视3D.

正如Sunil指出的那样,错误告诉您编译器找不到Matrix3D类。但是,我认为它是Sandy3D库中的Matrix3D类,而不是Flash播放器内置的版本。我认为您需要下载正确版本的 Sandy3D,并确保在编译器选项中正确引用它。

错误是说编译器找不到 Matrix3D 类,该类是 Flash Player 10.0 及更高版本中内置的类。

是否有可能您的项目的编译器设置指定了 Flash 9,因此它不知道 Matrix3D 类?

最新更新