一、前言
The primary goal in developing Physijs is to keep it as simple and user-friendly as possible. Physics engines can be daunting and difficult to set up, with so many options and configurations it is easy to feel overwhelmed. Physijs abstracts all of that extra logic out so you can focus on the rest of your project.
简单的来说,physijs这个名字看起来拼写错误的东西,是一套把ammo.js中的底层接口,抽象出来,针对three.js封装好之后,便于使用的物理引擎。
二、必读
本文不开发源码,如有需要可以自行在GitHub搜索相关工程。
三、兼容经历
1、物理引擎基于worker来进行模拟,而微信开发工具中worker却有bug,无法创建,在最新版本中以修复。
2、Physijs中包含physi.js、ammo.js、physijs_worker.js,除了ammo这个基础物理库以外,另外两个都有部分源码需要修改,主要是对wx的适配。
3、worker文件需要放在worker目录中,并在game.json中指明路径,worker中需要引用到的其他代码文

本文介绍了如何在微信小游戏开发中集成Three.js和Physijs物理引擎,解决worker兼容性问题,以及源码修改和目录配置。通过修改Physijs和Physiji_worker.js,实现了在微信小游戏中的物理效果。
最低0.47元/天 解锁文章
2万+





