• 首页
  • 动态
  • 案例
  • 引擎社区
  • API
  • 文档
  • 示例
  • 引擎下载

大约有 8 项符合查询结果, 库内数据总量为 31,560 项。 (搜索耗时: 0.0020 秒)

1. Mesh网格-自定义网格 [ 100%]

...BoxMesh(0.5, 0.5, 0.5))); box.transform.position = new Laya.Vector3(1.5, 0.25, 0.6); box.transform.rotate(new Laya.Vector3(0, 45, 0), false, false); //球体 var sphere = scene.addChild(new Laya.MeshSprite3D(new Laya.SphereMesh(0.25))); sphere.transform.position = new Laya.Vector3(0.5, 0.25, 0.6); /...

来源: Laya_示例 发布时间: 20251130

2. 射线检测-选取物体 [ 92%]

...Render.material = boxMat; box.transform.position = new Laya.Vector3(1.5, 0.25, 0.5); box.transform.rotate(new Laya.Vector3(0, 30, 0), false, false); var boxCollider1 = box.addComponent(Laya.BoxCollider); boxCollider1.setFromBoundBox(box.meshFilter.sharedMesh.boundingBox); box.name = "正方体"; //...

来源: Laya_示例 发布时间: 20251130

3. 射线检测-点击行走 [ 80%]

...0)); var point = new Laya.Vector2(); var _position = new Laya.Vector3(0, 0.25, 0); var _quaternion = new Laya.Quaternion(); var _outHitInfo = new Laya.RaycastHit(); function checkHit() { box.transform.position = _position; box.transform.rotation = _quaternion; //从屏幕空间生成射线 point.ele...

来源: Laya_示例 发布时间: 20251130

4. UI-ComboBox [ 79%]

...m1,item2,item3,item4,item5"); comboBox.labelSize = 30; comboBox.itemSize = 25; comboBox.selectHandler = new Handler(this, onSelect, [comboBox]); Laya.stage.addChild(comboBox); return comboBox; } function onSelect(cb) { console.log("选中了: " + cb.selectedLabel); } })();module laya { import Stag...

来源: Laya_示例 发布时间: 20251130

5. 射线检测-放置物体 [ 78%]

..._position = new Laya.Vector3(0, 0, 0); var _offset = new Laya.Vector3(0, 0.25, 0); //鼠标事件 Laya.stage.on(Laya.Event.MOUSE_UP, this, function () { if (_outHitInfo.distance !== -1) { var sphere = scene.addChild(new Laya.MeshSprite3D(new Laya.SphereMesh(0.25, 16, 16))); var mat = new Laya.Standa...

来源: Laya_示例 发布时间: 20251130

6. 音频-播放演示 [ 72%]

...rawRect(0, 0, w, h, "#FF7F50"); button.graphics.fillText(label, w / 2, 8, "25px SimHei", "#FFFFFF", "center"); Laya.stage.addChild(button); return button; } function onPlayMusic(e) { console.log("播放音乐"); SoundManager.playMusic("../../res/sounds/bgm.mp3", 1, new Handler(this, onComplete)); } ...

来源: Laya_示例 发布时间: 20251130

7. 物理引擎-Slingshot [ 71%]

... '../../res/physics/img/block-2.png'; return Matter.Bodies.rectangle(x, y, 25, 40, { render: { sprite: { texture: texture, xOffset: 20.5, yOffset: 28 } } }); }); var ground2 = Matter.Bodies.rectangle(610, 250, 200, 20, { isStatic: true, render: { fillStyle: '#edc51e', strokeStyle: '#b5a91c' } }); va...

来源: Laya_示例 发布时间: 20251130

8. 加载-销毁Texture使用的图片资源 [ 67%]

...; this.aniFly.loadAtlas(this.PathFly); this.aniFly.play(); this.aniFly.pos(250, 100); Laya.stage.addChild(this.aniFly); //创建按钮 this.btn = new Sprite().size(205, 55); this.btn.graphics.drawRect(0, 0, this.btn.width, this.btn.height, "#057AFB"); this.txt = new Text(); this.txt.text = "销毁";...

来源: Laya_示例 发布时间: 20251130