[]求助 Uncaught SyntaxError: Unexpected identifier
Uncaught SyntaxError: Unexpected identifier
这个是什么错?按照官网教程写的
这个是什么错?按照官网教程写的
//初始化3d画布
Laya3D.init(0, 0, true);
//设置全屏
Laya.stage.scaleMode = Stage.SCALE_FULL;
//显示统计数据
Stat.show();
// 给舞台添加laya3d场景
var scene= Laya.stage.addChild(new Scene()) as Scene;
//初始化照相机
var camera = scene.addChild(new Camera()) as Camera;
camera.transform.position = new Vector3(0, 3, 3);
camera.transform.rotate(new Vector3( -45, 0, 0), true, false);
camera.addComponent(CameraMoveScript);
// 生成平面,其实是一个box,只不过高度很小,可看成一个平面
var plane = scene.addChild(new MeshSprite3D(new BoxMesh(4,4,0.001))) as MeshSprite3D;
var material = new StandardMaterial();
material.albedo = new Vector4(1.3, 1.3, 1.3, 1);
material.diffuseTexture = Texture2D.load("res/bg.png");
plane.meshRender.material = material;
//生成坐标中心,其实是球体
var sphere = scene.addChild(new MeshSprite3D(new SphereMesh(0.05,100,100))) as MeshSprite3D;
var material = new StandardMaterial();
material.albedo = new Vector4(0, 0, 0, 1);
sphere.meshRender.material = material;
sphere.transform.position = new Vector3(0, 0, 0);
//模拟x轴,其实是方体
var x = scene.addChild(new MeshSprite3D(new BoxMesh(2,0.03,0.03))) as MeshSprite3D;
var material = new StandardMaterial();
material.albedo = new Vector4(1, 0, 0, 1);
x.meshRender.material = material;
x.transform.position = new Vector3(1, 0, 0);
//模拟y轴,其实是方体
var y = scene.addChild(new MeshSprite3D(new BoxMesh(0.03,0.03,2))) as MeshSprite3D;
var material = new StandardMaterial();
material.albedo = new Vector4(0, 1, 0, 1);
y.meshRender.material = material;
y.transform.position = new Vector3(0, 0, 0);
//模拟z轴,其实是方体
var z = scene.addChild(new MeshSprite3D(new BoxMesh(0.03,2,0.03))) as MeshSprite3D;
var material = new StandardMaterial();
material.albedo = new Vector4(0, 0, 1, 1);
z.meshRender.material = material;
z.transform.position = new Vector3(0, 0, 1);
//生成方体
var box = scene.addChild(new MeshSprite3D(new BoxMesh(0.3,0.3,0.3))) as MeshSprite3D;
var material = new StandardMaterial();
material.albedo = new Vector4(0.5, 0.5, 0.5, 1);
box.meshRender.material = material;
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
cuixueying
赞同来自: