Choosing The Physics System Suitable For Your Project

In the panel Project -> Project Settings -> Feature Cropping -> Physics System of the Editor, you can choose a physics engine suitable for the needs of the project for development. The default physics engine is bullet (ammo.js), which can be switched at will during the development process.

Physics Engine Options

If there are no need to use any physically related components and interfaces, uncheck the Physics System checkbox to make the package size smaller when publishing. But note that if the checkbox is unchecked, the project cannot use physically related components and interfaces, otherwise an error will be reported at runtime.

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: bullet (ammo.js)

ammo.js is the asm.js/wasm Version of the bullet physics engine, it is compiled by emscripten tool. Bullet has perfect physical functions, and we will put more work here in the future.

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.

results matching ""

    No results matching ""