How to disable all physics while build android template?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Nikas

I don’t using any physics in project - no Area2D or KinematicBody and want to delete all unneeded from export template. Especially any physics to make lighter native lib
libgodot_android.so .
I commenting unused modules, builtins and classes in
GODOT_SRC/godot/scene/register_scene_types.cpp.
And so it works.

But when I try to commenting any unused servers: arvr, physics, physics_2d then get crash so something use it.

When I run profiler it shows Physics Frame Time is about 0.01666 and Physics_2d 1 call per any frame.

How to disable any physics in project and better way exclude it from template build?

See also here:
Optimizing a build for size — Godot Engine (3.1) documentation in English

wombatstampede | 2019-12-06 14:34

:bust_in_silhouette: Reply From: Zylann

If you go commenting out classes manually then there is no official guarantee your export will work. The way it’s supposed to be done is, you disable modules in your SCons command (and of course have the export templates built yourself too). If the doc don’t show how to turn off 2D physics you might need to do a request for it to be supported.

I don’t think server APIs are supposed to be removed, what usually happens is, they get replaced with a dummy version that does nothing, because otherwise you would have to go through the tedious task of commenting out all calls to them through the codebase. That’s quite bad if you want to sync up with upstream Godot afterwards. But again, if you want this officially, better go ask for the feature (or PR it, if you can get it to work).

Physics Frame Time is about 0.01666

That precise value really looks like a report of delta time, not the actual time physics takes to process. Physics should have zero impact on CPU if you don’t use any.