你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
发现
话题
全文搜索
登录
[]discard property,please use transform's property instead
运行官网的3D例子时,浏览器一直报这个
没有找到相关结果
已邀请:
与内容相关的链接
提交
2 个回复
Aar0n
赞同来自:
就是那个属性弃用了,用transform , 那个代码估计过时了。
O-O
赞同来自:
看了warning的代码,是平行光那里的, 但是看API 没有transform 的属性,代码如下:
function LayaAir3D() {
//初始化微信小游戏
Laya.MiniAdpter.init();
//初始化引擎
Laya3D.init(0, 0, true);
//适配模式
Laya.stage.scaleMode = Laya.Stage.SCALE_FULL;
Laya.stage.screenMode = Laya.Stage.SCREEN_NONE;
//开启统计信息
Laya.Stat.show();
var scene = Laya.stage.addChild(new Laya.Scene());
var camera = scene.addChild(new Laya.Camera(0, 0.1, 1000));
camera.transform.translate(new Laya.Vector3(0, 1.5, 4));
camera.transform.rotate(new Laya.Vector3(-15, 0, 0), true, false);
camera.addComponent(CameraMoveScript);
//方向光
var directionLight = scene.addChild(new Laya.DirectionLight());
directionLight.color = new Laya.Vector3(0.7, 0.6, 0.6);
directionLight.direction = new Laya.Vector3(0, -1.0, -1.0);
//灯光开启阴影
directionLight.shadow = true;
//可见阴影距离
directionLight.shadowDistance = 3;
//生成阴影贴图尺寸
directionLight.shadowResolution = 2048;
//生成阴影贴图数量
directionLight.shadowPSSMCount = 1;
//模糊等级,越大越高,更耗性能
directionLight.shadowPCFType = 3;
Laya.loader.create([
"res/plane.lh",
"res/LayaMonkey.lh"
], Laya.Handler.create(this, onComplete));
var _quaternion = new Laya.Quaternion();
Laya.timer.frameLoop(1, null, function () {
Laya.Quaternion.createFromYawPitchRoll(0.025, 0, 0, _quaternion);
var _direction = directionLight.direction;
Laya.Vector3.transformQuat(_direction, _quaternion, _direction);
directionLight.direction = _direction;
});
function onComplete() {
var grid = scene.addChild(Laya.Sprite3D.load("res/plane.lh"));
//地面接收阴影
grid.getChildAt(0).meshRender.receiveShadow = true;
var layaMonkey = scene.addChild(Laya.Sprite3D.load("res/LayaMonkey.lh"));
//产生阴影
layaMonkey.getChildAt(0).getChildAt(0).skinnedMeshRender.castShadow = true;
layaMonkey.once(Laya.Event.HIERARCHY_LOADED, this, function () {
var aniSprite3d = layaMonkey.getChildAt(0);
var animator = aniSprite3d.getComponentByType(Laya.Animator);
animator.play(null, 1.0, 40, 70);
});
var monkeys = {};
var vx = -1.65;
var vz = -1.65;
for (var y = 0; y < 10; y++) {
for (var x = 0; x < 10; x++) {
monkeys['monkey_' + x] = Laya.Sprite3D.instantiate(layaMonkey, scene, false, new Laya.Vector3(vx, 0, vz));
vx += 0.3;
};
vz += 0.4;
vx = -1.65;
}
};
}
要回复问题请先
登录
发起人
O-O
相关问题
laya2.0加载3d场景报错Uncaught TypeError: Cannot read property 'btCollisionObject' of undefined
Unity导出插件导出的模型中Transform值有误
鼠标自定义样式官方有支持吗,Laya.Mouse.hide()会报Uncaught TypeError: Cannot read property 'cursor' of undefined错误
Uncaught TypeError: Cannot read property 'props' of undefined
子类父类都有regclass,但是编辑器没有暴露出父类的property
TrailSprite3D的ALIGNMENT_TRANSFORM_Z模式和ALIGNMENT_VIEW模式有什么区别?
Cannot read property 'displayObject' of null
做了一个最简单的显示微信子域的程序,但是报错Cannot read property 'USER_DATA_PATH' of undefined
这个怎么办 laya.core.js:16463 Uncaught TypeError: Cannot read property '_tf' of null
加载unity5.6.1导出来的场景提示Cannot read property 'charAt' of underfined
TypeError: Cannot set property 'text' of undefined
问题状态
最新活动:
2018-07-26 09:49
浏览:
2658
关注:
2
人
商务合作
2 个回复
Aar0n
赞同来自:
O-O
赞同来自:
function LayaAir3D() {
//初始化微信小游戏
Laya.MiniAdpter.init();
//初始化引擎
Laya3D.init(0, 0, true);
//适配模式
Laya.stage.scaleMode = Laya.Stage.SCALE_FULL;
Laya.stage.screenMode = Laya.Stage.SCREEN_NONE;
//开启统计信息
Laya.Stat.show();
var scene = Laya.stage.addChild(new Laya.Scene());
var camera = scene.addChild(new Laya.Camera(0, 0.1, 1000));
camera.transform.translate(new Laya.Vector3(0, 1.5, 4));
camera.transform.rotate(new Laya.Vector3(-15, 0, 0), true, false);
camera.addComponent(CameraMoveScript);
//方向光
var directionLight = scene.addChild(new Laya.DirectionLight());
directionLight.color = new Laya.Vector3(0.7, 0.6, 0.6);
directionLight.direction = new Laya.Vector3(0, -1.0, -1.0);
//灯光开启阴影
directionLight.shadow = true;
//可见阴影距离
directionLight.shadowDistance = 3;
//生成阴影贴图尺寸
directionLight.shadowResolution = 2048;
//生成阴影贴图数量
directionLight.shadowPSSMCount = 1;
//模糊等级,越大越高,更耗性能
directionLight.shadowPCFType = 3;
Laya.loader.create([
"res/plane.lh",
"res/LayaMonkey.lh"
], Laya.Handler.create(this, onComplete));
var _quaternion = new Laya.Quaternion();
Laya.timer.frameLoop(1, null, function () {
Laya.Quaternion.createFromYawPitchRoll(0.025, 0, 0, _quaternion);
var _direction = directionLight.direction;
Laya.Vector3.transformQuat(_direction, _quaternion, _direction);
directionLight.direction = _direction;
});
function onComplete() {
var grid = scene.addChild(Laya.Sprite3D.load("res/plane.lh"));
//地面接收阴影
grid.getChildAt(0).meshRender.receiveShadow = true;
var layaMonkey = scene.addChild(Laya.Sprite3D.load("res/LayaMonkey.lh"));
//产生阴影
layaMonkey.getChildAt(0).getChildAt(0).skinnedMeshRender.castShadow = true;
layaMonkey.once(Laya.Event.HIERARCHY_LOADED, this, function () {
var aniSprite3d = layaMonkey.getChildAt(0);
var animator = aniSprite3d.getComponentByType(Laya.Animator);
animator.play(null, 1.0, 40, 70);
});
var monkeys = {};
var vx = -1.65;
var vz = -1.65;
for (var y = 0; y < 10; y++) {
for (var x = 0; x < 10; x++) {
monkeys['monkey_' + x] = Laya.Sprite3D.instantiate(layaMonkey, scene, false, new Laya.Vector3(vx, 0, vz));
vx += 0.3;
};
vz += 0.4;
vx = -1.65;
}
};
}