playcavas是一款基于WebGL的游戏引擎,集UI、2D、3D、编辑器于一体。
一般来讲,游戏开发与web应用完全是两码事。但事实上游戏世界的很多工具都可以用在网站中增加华丽界面。PlayCavas就是一个基于WebGL的游戏引擎,结合了物理、光影、音效等工具,用于创建一个复杂的界面。
图形 -基于WebGL1和2构建的高级2D+3D图形引擎。动画 -强大的基于状态的动画,用于角色和任意场景属性物理 -与3D刚体物理引擎ammo.js完全集成输入 -鼠标,键盘,触摸,游戏手柄和VR控制器API声音 -基于WebAudioAPI构建的3D位置声音资产 -基于glTF2.0,Draco和Basis压缩构建的异步流系统脚本 -使用Typescript或JavaScript编写游戏行为示例代码:
// Create a PlayCavas applicatiovar cavas = documet.getElemetById("applicatio-cavas");var app = ew pc.fw.Applicatio(cavas, {});app.start();// Fill the available space at full resolutioapp.setCavasFillMode(pc.fw.FillMode.FILL_WINDOW);app.setCavasResolutio(pc.fw.ResolutioMode.AUTO);// Create box etityvar cube = ew pc.fw.Etity();app.cotext.systems.model.addCompoet(cube, { type: "box"});// Create camera etityvar camera = ew pc.fw.Etity();app.cotext.systems.camera.addCompoet(camera, { clearColor: ew pc.Color(0.1, 0.1, 0.1)});// Create directioal light etityvar light = ew pc.fw.Etity();app.cotext.systems.light.addCompoet(light);// Add to hierarchyapp.cotext.root.addChild(cube);app.cotext.root.addChild(camera);app.cotext.root.addChild(light);// Set up iitial positios ad orietatioscamera.setPositio(0, 0, 3);light.setEulerAgles(45, 0, 0);// Register a update evetapp.o("update", fuctio (deltaTime) { cube.rotate(10 * deltaTime, 20 * deltaTime, 30 * deltaTime);});









评论