Choosing The Physics System Suitable For Your Project
In the panel Project -> Project Settings -> Module Options of the Editor, you can choose a physics engine suitable for the needs of the project for development.
- The default is
- The physics engine can be switched at will during development.
Collision Detection: builtin
builtin only has the function of collision detection. Compared with other physics engines, it has no complicated physical simulation calculations. If your project does not require the physical simulation of this part, you can consider using builtin, which will make the size of game's package smaller.
If you use builtin for development, please note the following:
- builtin only has events of type trigger.
- isTrigger in Collider component is a trigger regardless of whether the value is true or false.
Physics Engine: cannon.js
cannon.js is an open source physics engine, which uses js language to develop and implement more comprehensive physics functions, if your project needs more complex physical functions, then you can consider using cannon.js. The size of the cannon.js module is 141KB.
Physics Engine: ammo.js
It should be noted that currently the ammo.js module has a size of about 1.5MB.
Do Not Use Physics
If you don't need to use any physics related components and interfaces, you can uncheck the yellow box, so that you can get a smaller package when publishing.
Note: if it is unchecked, the project will not be able to use physics related components and interfaces, otherwise an error will be reported during runtime.