大约有 168 项符合查询结果, 库内数据总量为 30,900 项。 (搜索耗时: 0.0054 秒)
...ss, property } = Laya; @regClass() export class LightOccluder extends Laya.Script { private spotLight: Laya.Sprite = new Laya.Sprite(); private background: Laya.Sprite = new Laya.Sprite(); private lightOccluder: Laya.Sprite = new Laya.Sprite(); private backgroundTexture: string = "resources/bg2.png"...
来源: Laya3.0_文档 发布时间: 20250214
...精灵添加组件(脚本) monkey.addComponent(MonkeyScript); scene.addChild(monkey); //设置相机的观察目标为小猴子 camera.transform.lookAt(monkey.transform.position, new Laya.Vector3(0, 1, 0)); ...
来源: Laya_社区 发布时间: 20190531
...动进入触发器的生命周期。 2.4.4 使用生命周期方法 创建Script3D脚本 生命周期的方法,只能在脚本类里使用,所以,我们需要创建一个脚本,3D游戏必须要继承3D的脚本Script3D。空脚本的示例代码如下: /** * TypeScript语言的3D脚本示...
来源: Laya3.0_文档 发布时间: 20250103
...例如下: const { regClass, property } = Laya; @regClass() export class Script extends Laya.Script { //declare owner : Laya.Sprite3D; @property({ type: Laya.Scene3D }) scene3d: Laya.Scene3D; constructor() { super(); } /** * 组件被激活后执行,此时所有节点和组件均已创建完毕...
来源: Laya3.0_文档 发布时间: 20250103
...** * 在节点上添加2D拖尾渲染器的示例代码 */ export class NewScript extends Laya.Script { declare owner: Laya.Sprite; private _trail2D: Laya.Trail2DRender; //从场景文件中获取到的宽度曲线数据 private _widthCurve: any[]; //从场景文件中获取到的颜色渐变数据 ...
来源: Laya3.0_文档 发布时间: 20250214
...例代码: const { regClass, property } = Laya; @regClass() export class Script extends Laya.Script { //declare owner : Laya.Sprite3D; @property({ type: Laya.Scene3D }) scene3d: Laya.Scene3D; constructor() { super(); } /** * 组件被激活后执行,此时所有节点和组件均已创建完毕...
来源: Laya3.0_文档 发布时间: 20250103
...置创建一个名为cameraroot 的sprit3D,给它添加一个cameraMoveScript脚本组件,然后cameraroot.addchild创建一个摄像机,设置好摄像机的默认位置角度使其朝向物体就行了 2017-07-14 1 1 分享 微博 QZONE 微信 183*****755 赞同来自: 需要开发者参...
来源: Laya_社区 发布时间: 20170714
...ass, property } = Laya; @regClass() export class Mesh2DRender extends Laya.Script { @property({type: Laya.Sprite}) private layaMonkey: Laya.Sprite; //组件被启用后执行,例如节点被添加到舞台后 onEnable(): void { Laya.loader.load("resources/layabox.png", Laya.Loader.IMAGE).then(() =...
来源: Laya3.0_文档 发布时间: 20250214
...例里摄像机绕物体旋转脚本的问题 官方案例里的CameraMoveScripts在2.0版本下有很多接口,属性不存在。比如this.camera.moveForward、 super._initialize(owner)、super._update(state)等,放在1.7版本里是有的。是不是LayaAir.d.ts有修改。现在有别的接...
来源: Laya_社区 发布时间: 20190224
...](img/3-2.png) (图3-2) 通过代码设置触发器的方式: ```typescript /* ……省略若干代码 */ //创建盒型MeshSprite3D let box = scene.addChild(new Laya.MeshSprite3D(Laya.PrimitiveMesh.createBox(sX, sY, sZ))) as Laya.MeshSprite3D; //创建静态碰撞器 let staticCollider:Laya....
来源: Laya2.0_文档 发布时间: 20210715