我试图让一个 2D 路径在 3d 中倾斜,然后一个 local3dtoglobal 方法现在工作了一段时间。我最初使用的是 Five3d,但被卡住了。我已经搬到 Away3D 并很快发现它已经超出了我的想象。我已经开始了,但什至无法让任何东西出现在舞台上。任何人都可以看看我是否走对了路线,任何人都可以指出为什么我在舞台上看不到任何东西。
我正在使用 Away3D fp10,因为我读到它可以绘制曲线,而 Away4 fp11 还没有这种能力。
谢谢
package
{
import away3d.cameras.TargetCamera3D;
import away3d.containers.View3D;
import away3d.core.base.Face;
import away3d.core.base.Mesh;
import away3d.materials.ColorMaterial;
import away3d.materials.Material;
import away3d.materials.WireColorMaterial;
import flash.display.Sprite;
import flash.events.Event;
public class Away3Dfp10Test extends Sprite
{
private var _camera:TargetCamera3D;
private var view:View3D;
public function Away3Dfp10Test()
{
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
protected function onAddedToStage(event:Event):void
{
// TODO Auto-generated method stub
this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
createView();
createScene();
}
private function createView():void
{
_camera = new TargetCamera3D();
_camera.z = -1000;
view = new View3D();
view.x = 400;
view.y = 300;
view.camera = _camera;
addChild(view);
}
private function createScene():void
{
var mesh:Mesh = new Mesh();
mesh.bothsides = false;
var material:WireColorMaterial = new WireColorMaterial(0xff0000);
material.thickness = 10;
material.color = 0x000000;
material.wireColor = 0x00ff00;
mesh.material = material;
var face:Face = new Face();
face.moveTo(0, 0, 0);
face.lineTo(0, 100, 0);
face.lineTo(100, 100, 0);
face.lineTo(100, 0, 0);
face.lineTo(0, 0, 0);
mesh.addFace(face);
view.scene.addChild(mesh);
view.render();
}
}
}