Browse Source

ADD URHO3D_PHYSICS AND URHO3D_NAVIGATION OPTIONS.

aster2013 11 years ago
parent
commit
25132bd4a0

+ 12 - 0
Source/CMake/Modules/Urho3D-CMake-common.cmake

@@ -42,6 +42,8 @@ option (URHO3D_64BIT "Enable 64-bit build")
 option (URHO3D_ANGELSCRIPT "Enable AngelScript scripting support" TRUE)
 option (URHO3D_ANGELSCRIPT "Enable AngelScript scripting support" TRUE)
 option (URHO3D_LUA "Enable additional Lua scripting support")
 option (URHO3D_LUA "Enable additional Lua scripting support")
 option (URHO3D_LUAJIT "Enable Lua scripting support using LuaJIT (check LuaJIT's CMakeLists.txt for more options)")
 option (URHO3D_LUAJIT "Enable Lua scripting support using LuaJIT (check LuaJIT's CMakeLists.txt for more options)")
+option (URHO3D_NAVIGATION "Enable navigation support" TRUE)
+option (URHO3D_PHYSICS "Enable physics support" TRUE)
 option (URHO3D_SSE "Enable SSE instruction set" ${URHO3D_DEFAULT_SSE})
 option (URHO3D_SSE "Enable SSE instruction set" ${URHO3D_DEFAULT_SSE})
 if (CMAKE_PROJECT_NAME STREQUAL Urho3D)
 if (CMAKE_PROJECT_NAME STREQUAL Urho3D)
     cmake_dependent_option (URHO3D_LUAJIT_AMALG "Enable LuaJIT amalgamated build (LuaJIT only)" FALSE "URHO3D_LUAJIT" FALSE)
     cmake_dependent_option (URHO3D_LUAJIT_AMALG "Enable LuaJIT amalgamated build (LuaJIT only)" FALSE "URHO3D_LUAJIT" FALSE)
@@ -178,6 +180,16 @@ if (URHO3D_LUA)
     add_definitions (-DURHO3D_LUA)
     add_definitions (-DURHO3D_LUA)
 endif ()
 endif ()
 
 
+# Add definition for Navigation
+if (URHO3D_NAVIGATION)
+    add_definitions (-DURHO3D_NAVIGATION)
+endif ()
+
+# Add definition for Physics
+if (URHO3D_PHYSICS)
+    add_definitions (-DURHO3D_PHYSICS)
+endif ()
+
 # Default library type is STATIC
 # Default library type is STATIC
 if (URHO3D_LIB_TYPE)
 if (URHO3D_LIB_TYPE)
     string (TOUPPER ${URHO3D_LIB_TYPE} URHO3D_LIB_TYPE)
     string (TOUPPER ${URHO3D_LIB_TYPE} URHO3D_LIB_TYPE)

+ 13 - 1
Source/CMakeLists.txt

@@ -145,17 +145,29 @@ if (NOT WIN32)
 endif ()
 endif ()
 
 
 # Add targets
 # Add targets
-foreach (TARGET Box2D Bullet Civetweb Detour FreeType JO kNet LZ4 PugiXml Recast SDL StanHull STB)
+foreach (TARGET Box2D Civetweb FreeType JO kNet LZ4 PugiXml SDL StanHull STB)
     add_subdirectory (ThirdParty/${TARGET})
     add_subdirectory (ThirdParty/${TARGET})
 endforeach ()
 endforeach ()
+
 if (URHO3D_ANGELSCRIPT)
 if (URHO3D_ANGELSCRIPT)
     add_subdirectory (ThirdParty/AngelScript)
     add_subdirectory (ThirdParty/AngelScript)
 endif ()
 endif ()
+
 if (URHO3D_LUA)
 if (URHO3D_LUA)
     add_subdirectory (Engine/LuaScript)
     add_subdirectory (Engine/LuaScript)
     add_subdirectory (ThirdParty/Lua${JIT})
     add_subdirectory (ThirdParty/Lua${JIT})
     add_subdirectory (ThirdParty/toluapp/src/lib)
     add_subdirectory (ThirdParty/toluapp/src/lib)
 endif ()
 endif ()
+
+if (URHO3D_NAVIGATION)
+    add_subdirectory (ThirdParty/Detour)
+    add_subdirectory (ThirdParty/Recast)
+endif ()
+
+if (URHO3D_PHYSICS)
+    add_subdirectory (ThirdParty/Bullet)
+endif ()
+
 if (NOT IOS AND NOT ANDROID AND NOT RASPI)
 if (NOT IOS AND NOT ANDROID AND NOT RASPI)
     if (URHO3D_OPENGL)
     if (URHO3D_OPENGL)
         add_subdirectory (ThirdParty/GLEW)
         add_subdirectory (ThirdParty/GLEW)

+ 10 - 1
Source/Engine/CMakeLists.txt

@@ -62,10 +62,19 @@ if (MSVC AND URHO3D_LIB_TYPE STREQUAL SHARED)   # MSVC linker does not have forc
 endif ()
 endif ()
 
 
 # Define source files
 # Define source files
-set (SOURCES Audio Container Core Engine Graphics Input IO Math Navigation Network Physics Resource Scene UI Urho2D)
+set (SOURCES Audio Container Core Engine Graphics Input IO Math Network Resource Scene UI Urho2D)
 if (URHO3D_ANGELSCRIPT)
 if (URHO3D_ANGELSCRIPT)
     list (APPEND SOURCES Script)
     list (APPEND SOURCES Script)
 endif ()
 endif ()
+
+if (URHO3D_NAVIGATION)
+    list (APPEND SOURCES Navigation)
+endif ()
+
+if (URHO3D_PHYSICS)
+    list (APPEND SOURCES Physics)
+endif ()
+
 foreach (SOURCE ${SOURCES})
 foreach (SOURCE ${SOURCES})
     add_subdirectory (${SOURCE})
     add_subdirectory (${SOURCE})
     install (DIRECTORY ${SOURCE}/ DESTINATION ${DEST_INCLUDE_DIR} ${DEST_PERMISSIONS} FILES_MATCHING PATTERN *.h)    # Note: the trailing slash is significant
     install (DIRECTORY ${SOURCE}/ DESTINATION ${DEST_INCLUDE_DIR} ${DEST_PERMISSIONS} FILES_MATCHING PATTERN *.h)    # Note: the trailing slash is significant

+ 10 - 0
Source/Engine/Engine/Engine.cpp

@@ -32,10 +32,14 @@
 #include "Input.h"
 #include "Input.h"
 #include "InputEvents.h"
 #include "InputEvents.h"
 #include "Log.h"
 #include "Log.h"
+#ifdef URHO3D_NAVIGATION
 #include "NavigationMesh.h"
 #include "NavigationMesh.h"
+#endif
 #include "Network.h"
 #include "Network.h"
 #include "PackageFile.h"
 #include "PackageFile.h"
+#ifdef URHO3D_PHYSICS
 #include "PhysicsWorld.h"
 #include "PhysicsWorld.h"
+#endif
 #include "ProcessUtils.h"
 #include "ProcessUtils.h"
 #include "Profiler.h"
 #include "Profiler.h"
 #include "Renderer.h"
 #include "Renderer.h"
@@ -115,8 +119,14 @@ Engine::Engine(Context* context) :
 
 
     // Register object factories for libraries which are not automatically registered along with subsystem creation
     // Register object factories for libraries which are not automatically registered along with subsystem creation
     RegisterSceneLibrary(context_);
     RegisterSceneLibrary(context_);
+
+#ifdef URHO3D_PHYSICS
     RegisterPhysicsLibrary(context_);
     RegisterPhysicsLibrary(context_);
+#endif
+    
+#ifdef URHO3D_NAVIGATION
     RegisterNavigationLibrary(context_);
     RegisterNavigationLibrary(context_);
+#endif
 
 
     SubscribeToEvent(E_EXITREQUESTED, HANDLER(Engine, HandleExitRequested));
     SubscribeToEvent(E_EXITREQUESTED, HANDLER(Engine, HandleExitRequested));
 }
 }

+ 21 - 2
Source/Engine/LuaScript/CMakeLists.txt

@@ -42,6 +42,17 @@ endif ()
 # Define generated source files
 # Define generated source files
 file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated)
 file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated)
 file (GLOB API_PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/*.pkg)
 file (GLOB API_PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/*.pkg)
+
+# Remove NavigationLuaAPI.pkg
+if (NOT URHO3D_NAVIGATION)
+    list (REMOVE_ITEM API_PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/NavigationLuaAPI.pkg)
+endif ()
+
+# Remove PhysicsLuaAPI.pkg
+if (NOT URHO3D_PHYSICS)
+    list (REMOVE_ITEM API_PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/PhysicsLuaAPI.pkg)
+endif ()
+
 foreach (API_PKG_FILE ${API_PKG_FILES})
 foreach (API_PKG_FILE ${API_PKG_FILES})
     get_filename_component (NAME ${API_PKG_FILE} NAME)
     get_filename_component (NAME ${API_PKG_FILE} NAME)
     string (REGEX REPLACE LuaAPI\\.pkg$ "" API ${NAME})
     string (REGEX REPLACE LuaAPI\\.pkg$ "" API ${NAME})
@@ -62,8 +73,16 @@ install (FILES ${H_FILES} DESTINATION ${DEST_INCLUDE_DIR})
 # Define dependency libs
 # Define dependency libs
 set (LIBS ../../ThirdParty/Lua${JIT}/src)
 set (LIBS ../../ThirdParty/Lua${JIT}/src)
 set (LINK_LIBS_ONLY toluapp)
 set (LINK_LIBS_ONLY toluapp)
-set (INCLUDE_DIRS_ONLY . .. ../Audio ../Container ../Core ../Engine ../Graphics ../Input ../IO ../Math ../Navigation ../Network ../Physics ../Resource ../Scene ../UI  ../Urho2D
-    ../../ThirdParty/Box2D ../../ThirdParty/Bullet/src ../../ThirdParty/kNet/include ../../ThirdParty/SDL/include ../../ThirdParty/toluapp/include ${CMAKE_BINARY_DIR}/Engine)
+set (INCLUDE_DIRS_ONLY . .. ../Audio ../Container ../Core ../Engine ../Graphics ../Input ../IO ../Math ../Navigation ../Network ../Resource ../Scene ../UI  ../Urho2D
+    ../../ThirdParty/Box2D ../../ThirdParty/kNet/include ../../ThirdParty/SDL/include ../../ThirdParty/toluapp/include ${CMAKE_BINARY_DIR}/Engine)
+
+if (URHO3D_NAVIGATION)
+    set (INCLUDE_DIRS_ONLY ${INCLUDE_DIRS_ONLY} ../Navigation)
+endif ()
+
+if (URHO3D_PHYSICS)
+    set (INCLUDE_DIRS_ONLY ${INCLUDE_DIRS_ONLY} ../Physics ../../ThirdParty/Bullet/src)
+endif ()
 
 
 # Setup target
 # Setup target
 setup_library ()
 setup_library ()

+ 12 - 0
Source/Engine/LuaScript/LuaScript.cpp

@@ -52,9 +52,13 @@ extern int tolua_GraphicsLuaAPI_open(lua_State*);
 extern int tolua_InputLuaAPI_open(lua_State*);
 extern int tolua_InputLuaAPI_open(lua_State*);
 extern int tolua_IOLuaAPI_open(lua_State*);
 extern int tolua_IOLuaAPI_open(lua_State*);
 extern int tolua_MathLuaAPI_open(lua_State*);
 extern int tolua_MathLuaAPI_open(lua_State*);
+#ifdef URHO3D_NAVIGATION
 extern int tolua_NavigationLuaAPI_open(lua_State*);
 extern int tolua_NavigationLuaAPI_open(lua_State*);
+#endif
 extern int tolua_NetworkLuaAPI_open(lua_State*);
 extern int tolua_NetworkLuaAPI_open(lua_State*);
+#ifdef URHO3D_PHYSICS
 extern int tolua_PhysicsLuaAPI_open(lua_State*);
 extern int tolua_PhysicsLuaAPI_open(lua_State*);
+#endif
 extern int tolua_ResourceLuaAPI_open(lua_State*);
 extern int tolua_ResourceLuaAPI_open(lua_State*);
 extern int tolua_SceneLuaAPI_open(lua_State*);
 extern int tolua_SceneLuaAPI_open(lua_State*);
 extern int tolua_UILuaAPI_open(lua_State*);
 extern int tolua_UILuaAPI_open(lua_State*);
@@ -95,9 +99,17 @@ LuaScript::LuaScript(Context* context) :
     tolua_EngineLuaAPI_open(luaState_);
     tolua_EngineLuaAPI_open(luaState_);
     tolua_GraphicsLuaAPI_open(luaState_);
     tolua_GraphicsLuaAPI_open(luaState_);
     tolua_InputLuaAPI_open(luaState_);
     tolua_InputLuaAPI_open(luaState_);
+
+#ifdef URHO3D_NAVIGATION
     tolua_NavigationLuaAPI_open(luaState_);
     tolua_NavigationLuaAPI_open(luaState_);
+#endif
+
     tolua_NetworkLuaAPI_open(luaState_);
     tolua_NetworkLuaAPI_open(luaState_);
+
+#ifdef URHO3D_PHYSICS
     tolua_PhysicsLuaAPI_open(luaState_);
     tolua_PhysicsLuaAPI_open(luaState_);
+#endif
+
     tolua_UILuaAPI_open(luaState_);
     tolua_UILuaAPI_open(luaState_);
     tolua_Urho2DLuaAPI_open(luaState_);
     tolua_Urho2DLuaAPI_open(luaState_);
     tolua_LuaScriptLuaAPI_open(luaState_);
     tolua_LuaScriptLuaAPI_open(luaState_);

+ 12 - 3
Source/Engine/LuaScript/LuaScriptInstance.cpp

@@ -29,8 +29,10 @@
 #include "LuaScript.h"
 #include "LuaScript.h"
 #include "LuaScriptInstance.h"
 #include "LuaScriptInstance.h"
 #include "MemoryBuffer.h"
 #include "MemoryBuffer.h"
+#ifdef URHO3D_PHYSICS
 #include "PhysicsEvents.h"
 #include "PhysicsEvents.h"
 #include "PhysicsWorld.h"
 #include "PhysicsWorld.h"
+#endif
 #include "ResourceCache.h"
 #include "ResourceCache.h"
 #include "Scene.h"
 #include "Scene.h"
 #include "SceneEvents.h"
 #include "SceneEvents.h"
@@ -594,7 +596,6 @@ void LuaScriptInstance::FindScriptObjectMethodRefs()
 void LuaScriptInstance::SubscribeToScriptMethodEvents()
 void LuaScriptInstance::SubscribeToScriptMethodEvents()
 {
 {
     Scene* scene = GetScene();
     Scene* scene = GetScene();
-    PhysicsWorld* physicsWorld = scene ? scene->GetComponent<PhysicsWorld>() : 0;
 
 
     if (scene && scriptObjectMethods_[LSOM_UPDATE])
     if (scene && scriptObjectMethods_[LSOM_UPDATE])
         SubscribeToEvent(scene, E_SCENEUPDATE, HANDLER(LuaScriptInstance, HandleUpdate));
         SubscribeToEvent(scene, E_SCENEUPDATE, HANDLER(LuaScriptInstance, HandleUpdate));
@@ -602,11 +603,15 @@ void LuaScriptInstance::SubscribeToScriptMethodEvents()
     if (scene && scriptObjectMethods_[LSOM_POSTUPDATE])
     if (scene && scriptObjectMethods_[LSOM_POSTUPDATE])
         SubscribeToEvent(scene, E_SCENEPOSTUPDATE, HANDLER(LuaScriptInstance, HandlePostUpdate));
         SubscribeToEvent(scene, E_SCENEPOSTUPDATE, HANDLER(LuaScriptInstance, HandlePostUpdate));
 
 
+#ifdef URHO3D_PHYSICS
+    PhysicsWorld* physicsWorld = scene ? scene->GetComponent<PhysicsWorld>() : 0;
+
     if (physicsWorld && scriptObjectMethods_[LSOM_FIXEDUPDATE])
     if (physicsWorld && scriptObjectMethods_[LSOM_FIXEDUPDATE])
         SubscribeToEvent(physicsWorld, E_PHYSICSPRESTEP, HANDLER(LuaScriptInstance, HandleFixedUpdate));
         SubscribeToEvent(physicsWorld, E_PHYSICSPRESTEP, HANDLER(LuaScriptInstance, HandleFixedUpdate));
 
 
     if (physicsWorld && scriptObjectMethods_[LSOM_FIXEDPOSTUPDATE])
     if (physicsWorld && scriptObjectMethods_[LSOM_FIXEDPOSTUPDATE])
         SubscribeToEvent(physicsWorld, E_PHYSICSPOSTSTEP, HANDLER(LuaScriptInstance, HandlePostFixedUpdate));
         SubscribeToEvent(physicsWorld, E_PHYSICSPOSTSTEP, HANDLER(LuaScriptInstance, HandlePostFixedUpdate));
+#endif
 
 
     if (node_ && scriptObjectMethods_[LSOM_TRANSFORMCHANGED])
     if (node_ && scriptObjectMethods_[LSOM_TRANSFORMCHANGED])
         node_->AddListener(this);
         node_->AddListener(this);
@@ -615,19 +620,21 @@ void LuaScriptInstance::SubscribeToScriptMethodEvents()
 void LuaScriptInstance::UnsubscribeFromScriptMethodEvents()
 void LuaScriptInstance::UnsubscribeFromScriptMethodEvents()
 {
 {
     Scene* scene = GetScene();
     Scene* scene = GetScene();
-    PhysicsWorld* physicsWorld = scene ? scene->GetComponent<PhysicsWorld>() : 0;
-
     if (scene && scriptObjectMethods_[LSOM_UPDATE])
     if (scene && scriptObjectMethods_[LSOM_UPDATE])
         UnsubscribeFromEvent(scene, E_SCENEUPDATE);
         UnsubscribeFromEvent(scene, E_SCENEUPDATE);
 
 
     if (scene && scriptObjectMethods_[LSOM_POSTUPDATE])
     if (scene && scriptObjectMethods_[LSOM_POSTUPDATE])
         UnsubscribeFromEvent(scene, E_SCENEPOSTUPDATE);
         UnsubscribeFromEvent(scene, E_SCENEPOSTUPDATE);
 
 
+#ifdef URHO3D_PHYSICS
+    PhysicsWorld* physicsWorld = scene ? scene->GetComponent<PhysicsWorld>() : 0;
+
     if (physicsWorld && scriptObjectMethods_[LSOM_FIXEDUPDATE])
     if (physicsWorld && scriptObjectMethods_[LSOM_FIXEDUPDATE])
         UnsubscribeFromEvent(physicsWorld, E_PHYSICSPRESTEP);
         UnsubscribeFromEvent(physicsWorld, E_PHYSICSPRESTEP);
 
 
     if (physicsWorld && scriptObjectMethods_[LSOM_FIXEDPOSTUPDATE])
     if (physicsWorld && scriptObjectMethods_[LSOM_FIXEDPOSTUPDATE])
         UnsubscribeFromEvent(physicsWorld, E_PHYSICSPOSTSTEP);
         UnsubscribeFromEvent(physicsWorld, E_PHYSICSPOSTSTEP);
+#endif
 
 
     if (node_ && scriptObjectMethods_[LSOM_TRANSFORMCHANGED])
     if (node_ && scriptObjectMethods_[LSOM_TRANSFORMCHANGED])
         node_->RemoveListener(this);
         node_->RemoveListener(this);
@@ -659,6 +666,7 @@ void LuaScriptInstance::HandlePostUpdate(StringHash eventType, VariantMap& event
     }
     }
 }
 }
 
 
+#ifdef URHO3D_PHYSICS
 void LuaScriptInstance::HandleFixedUpdate(StringHash eventType, VariantMap& eventData)
 void LuaScriptInstance::HandleFixedUpdate(StringHash eventType, VariantMap& eventData)
 {
 {
     using namespace PhysicsPreStep;
     using namespace PhysicsPreStep;
@@ -684,6 +692,7 @@ void LuaScriptInstance::HandlePostFixedUpdate(StringHash eventType, VariantMap&
         function->EndCall();
         function->EndCall();
     }
     }
 }
 }
+#endif
 
 
 void LuaScriptInstance::HandleEvent(StringHash eventType, VariantMap& eventData)
 void LuaScriptInstance::HandleEvent(StringHash eventType, VariantMap& eventData)
 {
 {

+ 2 - 0
Source/Engine/LuaScript/LuaScriptInstance.h

@@ -135,10 +135,12 @@ private:
     void HandleUpdate(StringHash eventType, VariantMap& eventData);
     void HandleUpdate(StringHash eventType, VariantMap& eventData);
     /// Handle the logic post update event.
     /// Handle the logic post update event.
     void HandlePostUpdate(StringHash eventType, VariantMap& eventData);
     void HandlePostUpdate(StringHash eventType, VariantMap& eventData);
+#ifdef URHO3D_PHYSICS
     /// Handle the physics update event.
     /// Handle the physics update event.
     void HandleFixedUpdate(StringHash eventType, VariantMap& eventData);
     void HandleFixedUpdate(StringHash eventType, VariantMap& eventData);
     /// Handle the physics post update event.
     /// Handle the physics post update event.
     void HandlePostFixedUpdate(StringHash eventType, VariantMap& eventData);
     void HandlePostFixedUpdate(StringHash eventType, VariantMap& eventData);
+#endif
     /// Handle event.
     /// Handle event.
     void HandleEvent(StringHash eventType, VariantMap& eventData);
     void HandleEvent(StringHash eventType, VariantMap& eventData);
     /// Handle a specific sender's event.
     /// Handle a specific sender's event.

+ 4 - 0
Source/Engine/LuaScript/ToluaUtils.cpp

@@ -302,6 +302,7 @@ template<> int ToluaPushPODVector<UIElement*>(lua_State* L, void* data, const ch
     return 1;
     return 1;
 }
 }
 
 
+#ifdef URHO3D_PHYSICS
 template<> int ToluaPushPODVector<RigidBody*>(lua_State* L, void* data, const char*)
 template<> int ToluaPushPODVector<RigidBody*>(lua_State* L, void* data, const char*)
 {
 {
     const PODVector<RigidBody*>& vector = *((const PODVector<RigidBody*>*)data);
     const PODVector<RigidBody*>& vector = *((const PODVector<RigidBody*>*)data);
@@ -313,6 +314,7 @@ template<> int ToluaPushPODVector<RigidBody*>(lua_State* L, void* data, const ch
     }
     }
     return 1;
     return 1;
 }
 }
+#endif
 
 
 template<> int ToluaPushPODVector<RigidBody2D*>(lua_State* L, void* data, const char*)
 template<> int ToluaPushPODVector<RigidBody2D*>(lua_State* L, void* data, const char*)
 {
 {
@@ -356,10 +358,12 @@ template<> int ToluaPushPODVector<OctreeQueryResult>(lua_State* L, void* data, c
     return tolua_pushurho3dpodvectorusertype(L, *((const PODVector<OctreeQueryResult>*)data), "OctreeQueryResult");
     return tolua_pushurho3dpodvectorusertype(L, *((const PODVector<OctreeQueryResult>*)data), "OctreeQueryResult");
 }
 }
 
 
+#ifdef URHO3D_PHYSICS
 template<> int ToluaPushPODVector<PhysicsRaycastResult>(lua_State* L, void* data, const char*)
 template<> int ToluaPushPODVector<PhysicsRaycastResult>(lua_State* L, void* data, const char*)
 {
 {
     return tolua_pushurho3dpodvectorusertype(L, *((const PODVector<PhysicsRaycastResult>*)data), "PhysicsRaycastResult");
     return tolua_pushurho3dpodvectorusertype(L, *((const PODVector<PhysicsRaycastResult>*)data), "PhysicsRaycastResult");
 }
 }
+#endif
 
 
 template<> int ToluaPushPODVector<PhysicsRaycastResult2D>(lua_State* L, void* data, const char*)
 template<> int ToluaPushPODVector<PhysicsRaycastResult2D>(lua_State* L, void* data, const char*)
 {
 {

+ 6 - 0
Source/Engine/LuaScript/ToluaUtils.h

@@ -24,7 +24,9 @@
 
 
 #include "Context.h"
 #include "Context.h"
 #include "OctreeQuery.h"
 #include "OctreeQuery.h"
+#ifdef URHO3D_PHYSICS
 #include "PhysicsWorld.h"
 #include "PhysicsWorld.h"
+#endif
 #include "PhysicsWorld2D.h"
 #include "PhysicsWorld2D.h"
 #include "Vector2.h"
 #include "Vector2.h"
 #include "Vector3.h"
 #include "Vector3.h"
@@ -117,8 +119,10 @@ template<> int ToluaPushPODVector<unsigned>(lua_State* L, void* data, const char
 template<> int ToluaPushPODVector<SoundSource*>(lua_State* L, void* data, const char* type);
 template<> int ToluaPushPODVector<SoundSource*>(lua_State* L, void* data, const char* type);
 /// Push PODVector<UIElement*> to Lua as a table.
 /// Push PODVector<UIElement*> to Lua as a table.
 template<> int ToluaPushPODVector<UIElement*>(lua_State* L, void* data, const char* type);
 template<> int ToluaPushPODVector<UIElement*>(lua_State* L, void* data, const char* type);
+#ifdef URHO3D_PHYSICS
 /// Push PODVector<RigidBody*> to Lua as a table.
 /// Push PODVector<RigidBody*> to Lua as a table.
 template<> int ToluaPushPODVector<RigidBody*>(lua_State* L, void* data, const char* type);
 template<> int ToluaPushPODVector<RigidBody*>(lua_State* L, void* data, const char* type);
+#endif
 /// Push PODVector<RigidBody2D*> to Lua as a table.
 /// Push PODVector<RigidBody2D*> to Lua as a table.
 template<> int ToluaPushPODVector<RigidBody2D*>(lua_State* L, void* data, const char* type);
 template<> int ToluaPushPODVector<RigidBody2D*>(lua_State* L, void* data, const char* type);
 /// Push PODVector<Vector3> to Lua as a table.
 /// Push PODVector<Vector3> to Lua as a table.
@@ -127,8 +131,10 @@ template<> int ToluaPushPODVector<Vector3>(lua_State* L, void* data, const char*
 template<> int ToluaPushPODVector<IntVector2>(lua_State* L, void* data, const char* type);
 template<> int ToluaPushPODVector<IntVector2>(lua_State* L, void* data, const char* type);
 /// Push PODVector<OctreeQueryResult> to Lua as a table.
 /// Push PODVector<OctreeQueryResult> to Lua as a table.
 template<> int ToluaPushPODVector<OctreeQueryResult>(lua_State* L, void* data, const char* type);
 template<> int ToluaPushPODVector<OctreeQueryResult>(lua_State* L, void* data, const char* type);
+#ifdef URHO3D_PHYSICS
 /// Push PODVector<PhysicsRaycastResult> to Lua as a table.
 /// Push PODVector<PhysicsRaycastResult> to Lua as a table.
 template<> int ToluaPushPODVector<PhysicsRaycastResult>(lua_State* L, void* data, const char* type);
 template<> int ToluaPushPODVector<PhysicsRaycastResult>(lua_State* L, void* data, const char* type);
+#endif
 /// Push PODVector<PhysicsRaycastResult2D> to Lua as a table.
 /// Push PODVector<PhysicsRaycastResult2D> to Lua as a table.
 template<> int ToluaPushPODVector<PhysicsRaycastResult2D>(lua_State* L, void* data, const char* type);
 template<> int ToluaPushPODVector<PhysicsRaycastResult2D>(lua_State* L, void* data, const char* type);
 /// Push PODVector<RayQueryResult> to Lua as a table.
 /// Push PODVector<RayQueryResult> to Lua as a table.

+ 1 - 0
Source/Engine/LuaScript/pkgs/Core/Variant.pkg

@@ -1,4 +1,5 @@
 $#include "Variant.h"
 $#include "Variant.h"
+$#include "VectorBuffer.h"
 
 
 enum VariantType
 enum VariantType
 {
 {

+ 8 - 3
Source/Engine/Navigation/NavigationMesh.cpp

@@ -21,7 +21,9 @@
 //
 //
 
 
 #include "Precompiled.h"
 #include "Precompiled.h"
+#ifdef URHO3D_PHYSICS
 #include "CollisionShape.h"
 #include "CollisionShape.h"
+#endif
 #include "Context.h"
 #include "Context.h"
 #include "DebugRenderer.h"
 #include "DebugRenderer.h"
 #include "Drawable.h"
 #include "Drawable.h"
@@ -799,6 +801,7 @@ void NavigationMesh::CollectGeometries(Vector<NavigationGeometryInfo>& geometryL
     
     
     Matrix3x4 inverse = node_->GetWorldTransform().Inverse();
     Matrix3x4 inverse = node_->GetWorldTransform().Inverse();
     
     
+#ifdef URHO3D_PHYSICS
     // Prefer compatible physics collision shapes (triangle mesh, convex hull, box) if found.
     // Prefer compatible physics collision shapes (triangle mesh, convex hull, box) if found.
     // Then fallback to visible geometry
     // Then fallback to visible geometry
     PODVector<CollisionShape*> collisionShapes;
     PODVector<CollisionShape*> collisionShapes;
@@ -825,8 +828,8 @@ void NavigationMesh::CollectGeometries(Vector<NavigationGeometryInfo>& geometryL
             collisionShapeFound = true;
             collisionShapeFound = true;
         }
         }
     }
     }
-    
     if (!collisionShapeFound)
     if (!collisionShapeFound)
+#endif
     {
     {
         PODVector<Drawable*> drawables;
         PODVector<Drawable*> drawables;
         node->GetDerivedComponents<Drawable>(drawables);
         node->GetDerivedComponents<Drawable>(drawables);
@@ -884,11 +887,13 @@ void NavigationMesh::GetTileGeometry(NavigationBuildData& build, Vector<Navigati
                 build.offMeshRadii_.Push(connection->GetRadius());
                 build.offMeshRadii_.Push(connection->GetRadius());
                 /// \todo Allow to define custom flags
                 /// \todo Allow to define custom flags
                 build.offMeshFlags_.Push(0x1);
                 build.offMeshFlags_.Push(0x1);
+
                 build.offMeshAreas_.Push(0);
                 build.offMeshAreas_.Push(0);
                 build.offMeshDir_.Push(connection->IsBidirectional() ? DT_OFFMESH_CON_BIDIR : 0);
                 build.offMeshDir_.Push(connection->IsBidirectional() ? DT_OFFMESH_CON_BIDIR : 0);
                 continue;
                 continue;
             }
             }
-            
+
+#ifdef URHO3D_PHYSICS
             CollisionShape* shape = dynamic_cast<CollisionShape*>(geometryList[i].component_);
             CollisionShape* shape = dynamic_cast<CollisionShape*>(geometryList[i].component_);
             if (shape)
             if (shape)
             {
             {
@@ -953,7 +958,7 @@ void NavigationMesh::GetTileGeometry(NavigationBuildData& build, Vector<Navigati
                 
                 
                 continue;
                 continue;
             }
             }
-            
+#endif
             Drawable* drawable = dynamic_cast<Drawable*>(geometryList[i].component_);
             Drawable* drawable = dynamic_cast<Drawable*>(geometryList[i].component_);
             if (drawable)
             if (drawable)
             {
             {

+ 7 - 1
Source/Engine/Scene/LogicComponent.cpp

@@ -23,8 +23,10 @@
 #include "Precompiled.h"
 #include "Precompiled.h"
 #include "Log.h"
 #include "Log.h"
 #include "LogicComponent.h"
 #include "LogicComponent.h"
+#ifdef URHO3D_PHYSICS
 #include "PhysicsEvents.h"
 #include "PhysicsEvents.h"
 #include "PhysicsWorld.h"
 #include "PhysicsWorld.h"
+#endif
 #include "Scene.h"
 #include "Scene.h"
 #include "SceneEvents.h"
 #include "SceneEvents.h"
 
 
@@ -111,7 +113,8 @@ void LogicComponent::UpdateEventSubscription()
         UnsubscribeFromEvent(scene, E_SCENEPOSTUPDATE);
         UnsubscribeFromEvent(scene, E_SCENEPOSTUPDATE);
         currentEventMask_ &= ~USE_POSTUPDATE;
         currentEventMask_ &= ~USE_POSTUPDATE;
     }
     }
-    
+
+#ifdef URHO3D_PHYSICS
     PhysicsWorld* world = scene->GetComponent<PhysicsWorld>();
     PhysicsWorld* world = scene->GetComponent<PhysicsWorld>();
     if (!world)
     if (!world)
         return;
         return;
@@ -139,6 +142,7 @@ void LogicComponent::UpdateEventSubscription()
         UnsubscribeFromEvent(world, E_PHYSICSPOSTSTEP);
         UnsubscribeFromEvent(world, E_PHYSICSPOSTSTEP);
         currentEventMask_ &= ~USE_FIXEDPOSTUPDATE;
         currentEventMask_ &= ~USE_FIXEDPOSTUPDATE;
     }
     }
+#endif 
 }
 }
 
 
 void LogicComponent::HandleSceneUpdate(StringHash eventType, VariantMap& eventData)
 void LogicComponent::HandleSceneUpdate(StringHash eventType, VariantMap& eventData)
@@ -172,6 +176,7 @@ void LogicComponent::HandleScenePostUpdate(StringHash eventType, VariantMap& eve
     PostUpdate(eventData[P_TIMESTEP].GetFloat());
     PostUpdate(eventData[P_TIMESTEP].GetFloat());
 }
 }
 
 
+#ifdef URHO3D_PHYSICS
 void LogicComponent::HandlePhysicsPreStep(StringHash eventType, VariantMap& eventData)
 void LogicComponent::HandlePhysicsPreStep(StringHash eventType, VariantMap& eventData)
 {
 {
     using namespace PhysicsPreStep;
     using namespace PhysicsPreStep;
@@ -187,5 +192,6 @@ void LogicComponent::HandlePhysicsPostStep(StringHash eventType, VariantMap& eve
     // Execute user-defined fixed post-update function
     // Execute user-defined fixed post-update function
     FixedPostUpdate(eventData[P_TIMESTEP].GetFloat());
     FixedPostUpdate(eventData[P_TIMESTEP].GetFloat());
 }
 }
+#endif
 
 
 }
 }

+ 2 - 1
Source/Engine/Scene/LogicComponent.h

@@ -82,11 +82,12 @@ private:
     void HandleSceneUpdate(StringHash eventType, VariantMap& eventData);
     void HandleSceneUpdate(StringHash eventType, VariantMap& eventData);
     /// Handle scene post-update event.
     /// Handle scene post-update event.
     void HandleScenePostUpdate(StringHash eventType, VariantMap& eventData);
     void HandleScenePostUpdate(StringHash eventType, VariantMap& eventData);
+#ifdef URHO3D_PHYSICS
     /// Handle physics pre-step event.
     /// Handle physics pre-step event.
     void HandlePhysicsPreStep(StringHash eventType, VariantMap& eventData);
     void HandlePhysicsPreStep(StringHash eventType, VariantMap& eventData);
     /// Handle physics post-step event.
     /// Handle physics post-step event.
     void HandlePhysicsPostStep(StringHash eventType, VariantMap& eventData);
     void HandlePhysicsPostStep(StringHash eventType, VariantMap& eventData);
-    
+#endif
     /// Requested event subscription mask.
     /// Requested event subscription mask.
     unsigned char updateEventMask_;
     unsigned char updateEventMask_;
     /// Current event subscription mask.
     /// Current event subscription mask.

+ 5 - 2
Source/Engine/Script/CMakeLists.txt

@@ -24,5 +24,8 @@
 define_source_files (PARENT_SCOPE)
 define_source_files (PARENT_SCOPE)
 
 
 # Define dependency libs
 # Define dependency libs
-set (ENGINE_INCLUDE_DIRS_ONLY ${ENGINE_INCLUDE_DIRS_ONLY} ../ThirdParty/AngelScript/include ../ThirdParty/Bullet/src ../ThirdParty/kNet/include PARENT_SCOPE)
-
+if (URHO3D_PHYSICS)
+    set (ENGINE_INCLUDE_DIRS_ONLY ${ENGINE_INCLUDE_DIRS_ONLY} ../ThirdParty/AngelScript/include ../ThirdParty/Bullet/src ../ThirdParty/kNet/include PARENT_SCOPE)
+else ()
+    set (ENGINE_INCLUDE_DIRS_ONLY ${ENGINE_INCLUDE_DIRS_ONLY} ../ThirdParty/AngelScript/include ../ThirdParty/kNet/include PARENT_SCOPE)
+endif ()

+ 2 - 0
Source/Engine/Script/NavigationAPI.cpp

@@ -21,6 +21,7 @@
 //
 //
 
 
 #include "Precompiled.h"
 #include "Precompiled.h"
+#ifdef URHO3D_NAVIGATION
 #include "APITemplates.h"
 #include "APITemplates.h"
 #include "Navigable.h"
 #include "Navigable.h"
 #include "NavigationMesh.h"
 #include "NavigationMesh.h"
@@ -109,3 +110,4 @@ void RegisterNavigationAPI(asIScriptEngine* engine)
 }
 }
 
 
 }
 }
+#endif

+ 2 - 0
Source/Engine/Script/PhysicsAPI.cpp

@@ -21,6 +21,7 @@
 //
 //
 
 
 #include "Precompiled.h"
 #include "Precompiled.h"
+#ifdef URHO3D_PHYSICS
 #include "APITemplates.h"
 #include "APITemplates.h"
 #include "CollisionShape.h"
 #include "CollisionShape.h"
 #include "Constraint.h"
 #include "Constraint.h"
@@ -325,3 +326,4 @@ void RegisterPhysicsAPI(asIScriptEngine* engine)
 }
 }
 
 
 }
 }
+#endif

+ 4 - 0
Source/Engine/Script/Script.cpp

@@ -82,8 +82,12 @@ Script::Script(Context* context) :
     RegisterAudioAPI(scriptEngine_);
     RegisterAudioAPI(scriptEngine_);
     RegisterUIAPI(scriptEngine_);
     RegisterUIAPI(scriptEngine_);
     RegisterNetworkAPI(scriptEngine_);
     RegisterNetworkAPI(scriptEngine_);
+#ifdef URHO3D_PHYSICS
     RegisterPhysicsAPI(scriptEngine_);
     RegisterPhysicsAPI(scriptEngine_);
+#endif
+#ifdef URHO3D_NAVIGATION
     RegisterNavigationAPI(scriptEngine_);
     RegisterNavigationAPI(scriptEngine_);
+#endif
     RegisterUrho2DAPI(scriptEngine_);
     RegisterUrho2DAPI(scriptEngine_);
     RegisterScriptAPI(scriptEngine_);
     RegisterScriptAPI(scriptEngine_);
     RegisterEngineAPI(scriptEngine_);
     RegisterEngineAPI(scriptEngine_);

+ 4 - 0
Source/Engine/Script/ScriptAPI.h

@@ -49,10 +49,14 @@ void RegisterAudioAPI(asIScriptEngine* engine);
 void RegisterUIAPI(asIScriptEngine* engine);
 void RegisterUIAPI(asIScriptEngine* engine);
 /// Register the Network library to script.
 /// Register the Network library to script.
 void RegisterNetworkAPI(asIScriptEngine* engine);
 void RegisterNetworkAPI(asIScriptEngine* engine);
+#ifdef URHO3D_PHYSICS
 /// Register the Physics library to script.
 /// Register the Physics library to script.
 void RegisterPhysicsAPI(asIScriptEngine* engine);
 void RegisterPhysicsAPI(asIScriptEngine* engine);
+#endif
+#ifdef URHO3D_NAVIGATION
 /// Register the Navigation library to script.
 /// Register the Navigation library to script.
 void RegisterNavigationAPI(asIScriptEngine* engine);
 void RegisterNavigationAPI(asIScriptEngine* engine);
+#endif
 /// Register the Urho2D library to script.
 /// Register the Urho2D library to script.
 void RegisterUrho2DAPI(asIScriptEngine* engine);
 void RegisterUrho2DAPI(asIScriptEngine* engine);
 /// Register the Script library to script.
 /// Register the Script library to script.

+ 8 - 3
Source/Engine/Script/ScriptInstance.cpp

@@ -24,8 +24,10 @@
 #include "Context.h"
 #include "Context.h"
 #include "Log.h"
 #include "Log.h"
 #include "MemoryBuffer.h"
 #include "MemoryBuffer.h"
+#ifdef URHO3D_PHYSICS
 #include "PhysicsEvents.h"
 #include "PhysicsEvents.h"
 #include "PhysicsWorld.h"
 #include "PhysicsWorld.h"
+#endif
 #include "Profiler.h"
 #include "Profiler.h"
 #include "ResourceCache.h"
 #include "ResourceCache.h"
 #include "ResourceEvents.h"
 #include "ResourceEvents.h"
@@ -634,6 +636,7 @@ void ScriptInstance::UpdateEventSubscription()
             if (methods_[METHOD_POSTUPDATE])
             if (methods_[METHOD_POSTUPDATE])
                 SubscribeToEvent(scene, E_SCENEPOSTUPDATE, HANDLER(ScriptInstance, HandleScenePostUpdate));
                 SubscribeToEvent(scene, E_SCENEPOSTUPDATE, HANDLER(ScriptInstance, HandleScenePostUpdate));
 
 
+#ifdef URHO3D_PHYSICS
             if (methods_[METHOD_FIXEDUPDATE] || methods_[METHOD_FIXEDPOSTUPDATE])
             if (methods_[METHOD_FIXEDUPDATE] || methods_[METHOD_FIXEDPOSTUPDATE])
             {
             {
                 PhysicsWorld* world = scene->GetOrCreateComponent<PhysicsWorld>();
                 PhysicsWorld* world = scene->GetOrCreateComponent<PhysicsWorld>();
@@ -647,7 +650,7 @@ void ScriptInstance::UpdateEventSubscription()
                 else
                 else
                     LOGERROR("No physics world, can not subscribe script object to fixed update events");
                     LOGERROR("No physics world, can not subscribe script object to fixed update events");
             }
             }
-
+#endif
             subscribedPostFixed_ = true;
             subscribedPostFixed_ = true;
         }
         }
 
 
@@ -665,13 +668,14 @@ void ScriptInstance::UpdateEventSubscription()
         if (subscribedPostFixed_)
         if (subscribedPostFixed_)
         {
         {
             UnsubscribeFromEvent(scene, E_SCENEPOSTUPDATE);
             UnsubscribeFromEvent(scene, E_SCENEPOSTUPDATE);
-
+#ifdef URHO3D_PHYSICS
             PhysicsWorld* world = scene->GetComponent<PhysicsWorld>();
             PhysicsWorld* world = scene->GetComponent<PhysicsWorld>();
             if (world)
             if (world)
             {
             {
                 UnsubscribeFromEvent(world, E_PHYSICSPRESTEP);
                 UnsubscribeFromEvent(world, E_PHYSICSPRESTEP);
                 UnsubscribeFromEvent(world, E_PHYSICSPOSTSTEP);
                 UnsubscribeFromEvent(world, E_PHYSICSPOSTSTEP);
             }
             }
+#endif
 
 
             subscribedPostFixed_ = false;
             subscribedPostFixed_ = false;
         }
         }
@@ -740,6 +744,7 @@ void ScriptInstance::HandleScenePostUpdate(StringHash eventType, VariantMap& eve
     scriptFile_->Execute(scriptObject_, methods_[METHOD_POSTUPDATE], parameters);
     scriptFile_->Execute(scriptObject_, methods_[METHOD_POSTUPDATE], parameters);
 }
 }
 
 
+#ifdef URHO3D_PHYSICS
 void ScriptInstance::HandlePhysicsPreStep(StringHash eventType, VariantMap& eventData)
 void ScriptInstance::HandlePhysicsPreStep(StringHash eventType, VariantMap& eventData)
 {
 {
     if (!scriptObject_)
     if (!scriptObject_)
@@ -763,7 +768,7 @@ void ScriptInstance::HandlePhysicsPostStep(StringHash eventType, VariantMap& eve
     parameters.Push(eventData[P_TIMESTEP]);
     parameters.Push(eventData[P_TIMESTEP]);
     scriptFile_->Execute(scriptObject_, methods_[METHOD_FIXEDPOSTUPDATE], parameters);
     scriptFile_->Execute(scriptObject_, methods_[METHOD_FIXEDPOSTUPDATE], parameters);
 }
 }
-
+#endif
 void ScriptInstance::HandleScriptEvent(StringHash eventType, VariantMap& eventData)
 void ScriptInstance::HandleScriptEvent(StringHash eventType, VariantMap& eventData)
 {
 {
     if (!IsEnabledEffective() || !scriptFile_ || !scriptObject_)
     if (!IsEnabledEffective() || !scriptFile_ || !scriptObject_)

+ 2 - 0
Source/Engine/Script/ScriptInstance.h

@@ -158,10 +158,12 @@ private:
     void HandleSceneUpdate(StringHash eventType, VariantMap& eventData);
     void HandleSceneUpdate(StringHash eventType, VariantMap& eventData);
     /// Handle scene post-update event.
     /// Handle scene post-update event.
     void HandleScenePostUpdate(StringHash eventType, VariantMap& eventData);
     void HandleScenePostUpdate(StringHash eventType, VariantMap& eventData);
+#ifdef URHO3D_PHYSICS
     /// Handle physics pre-step event.
     /// Handle physics pre-step event.
     void HandlePhysicsPreStep(StringHash eventType, VariantMap& eventData);
     void HandlePhysicsPreStep(StringHash eventType, VariantMap& eventData);
     /// Handle physics post-step event.
     /// Handle physics post-step event.
     void HandlePhysicsPostStep(StringHash eventType, VariantMap& eventData);
     void HandlePhysicsPostStep(StringHash eventType, VariantMap& eventData);
+#endif
     /// Handle an event in script.
     /// Handle an event in script.
     void HandleScriptEvent(StringHash eventType, VariantMap& eventData);
     void HandleScriptEvent(StringHash eventType, VariantMap& eventData);
     /// Handle script file reload start.
     /// Handle script file reload start.

+ 10 - 4
Source/Samples/CMakeLists.txt

@@ -44,15 +44,21 @@ add_subdirectory (07_Billboards)
 add_subdirectory (08_Decals)
 add_subdirectory (08_Decals)
 add_subdirectory (09_MultipleViewports)
 add_subdirectory (09_MultipleViewports)
 add_subdirectory (10_RenderToTexture)
 add_subdirectory (10_RenderToTexture)
-add_subdirectory (11_Physics)
-add_subdirectory (12_PhysicsStressTest)
-add_subdirectory (13_Ragdolls)
+if (URHO3D_PHYSICS)
+    add_subdirectory (11_Physics)
+    add_subdirectory (12_PhysicsStressTest)
+    add_subdirectory (13_Ragdolls)
+endif ()
 add_subdirectory (14_SoundEffects)
 add_subdirectory (14_SoundEffects)
-add_subdirectory (15_Navigation)
+if (URHO3D_NAVIGATION)
+    add_subdirectory (15_Navigation)
+endif ()
 add_subdirectory (16_Chat)
 add_subdirectory (16_Chat)
+if (URHO3D_PHYSICS)
 add_subdirectory (17_SceneReplication)
 add_subdirectory (17_SceneReplication)
 add_subdirectory (18_CharacterDemo)
 add_subdirectory (18_CharacterDemo)
 add_subdirectory (19_VehicleDemo)
 add_subdirectory (19_VehicleDemo)
+endif ()
 add_subdirectory (20_HugeObjectCount)
 add_subdirectory (20_HugeObjectCount)
 if (URHO3D_ANGELSCRIPT)
 if (URHO3D_ANGELSCRIPT)
     add_subdirectory (21_AngelScriptIntegration)
     add_subdirectory (21_AngelScriptIntegration)

+ 6 - 0
Source/Tools/AssetImporter/AssetImporter.cpp

@@ -33,7 +33,9 @@
 #include "Material.h"
 #include "Material.h"
 #include "Model.h"
 #include "Model.h"
 #include "Octree.h"
 #include "Octree.h"
+#ifdef URHO3D_PHYSICS
 #include "PhysicsWorld.h"
 #include "PhysicsWorld.h"
+#endif
 #include "ProcessUtils.h"
 #include "ProcessUtils.h"
 #include "Quaternion.h"
 #include "Quaternion.h"
 #include "ResourceCache.h"
 #include "ResourceCache.h"
@@ -247,7 +249,9 @@ void Run(const Vector<String>& arguments)
     context_->RegisterSubsystem(new WorkQueue(context_));
     context_->RegisterSubsystem(new WorkQueue(context_));
     RegisterSceneLibrary(context_);
     RegisterSceneLibrary(context_);
     RegisterGraphicsLibrary(context_);
     RegisterGraphicsLibrary(context_);
+#ifdef URHO3D_PHYSICS
     RegisterPhysicsLibrary(context_);
     RegisterPhysicsLibrary(context_);
+#endif
     
     
     String command = arguments[0].ToLower();
     String command = arguments[0].ToLower();
     String rootNodeName;
     String rootNodeName;
@@ -1309,8 +1313,10 @@ void BuildAndSaveScene(OutScene& scene, bool asPrefab)
     
     
     if (!asPrefab)
     if (!asPrefab)
     {
     {
+        #ifdef URHO3D_PHYSICS
         /// \todo Make the physics properties configurable
         /// \todo Make the physics properties configurable
         outScene->CreateComponent<PhysicsWorld>();
         outScene->CreateComponent<PhysicsWorld>();
+        #endif
     
     
         /// \todo Make the octree properties configurable, or detect from the scene contents
         /// \todo Make the octree properties configurable, or detect from the scene contents
         outScene->CreateComponent<Octree>();
         outScene->CreateComponent<Octree>();