diff options
author | Nick Samarin <nicks1987@bigmir.net> | 2010-06-10 04:19:06 +0400 |
---|---|---|
committer | Nick Samarin <nicks1987@bigmir.net> | 2010-06-10 04:19:06 +0400 |
commit | 0183d551089c727724db13a67537156f157ae262 (patch) | |
tree | b1d21b4b6f89679be9941c188e00996b81b92cb5 /source/gameengine/Ketsji/KX_Scene.cpp | |
parent | 9d1b8bf0f801572fb1f25000883ce434aad3f964 (diff) |
Added parameters for obstacle avoidance simulation: for object - flag for creation representation in simulation(OB_HASOBSTACLE) and obstacle radius (obstacleRad), for scene - obstacle simulation type (obstacleSimulation); added ui for new parameters
Diffstat (limited to 'source/gameengine/Ketsji/KX_Scene.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 63a7dc1ba2c..825d9317185 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -211,7 +211,15 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice, m_bucketmanager=new RAS_BucketManager(); - m_obstacleSimulation = new KX_ObstacleSimulationTOI;//KX_ObstacleSimulation; + switch (scene->gm.obstacleSimulation) + { + case OBSTSIMULATION_TOI: + m_obstacleSimulation = new KX_ObstacleSimulationTOI; + break; + default: + m_obstacleSimulation = NULL; + } + #ifndef DISABLE_PYTHON m_attr_dict = PyDict_New(); /* new ref */ @@ -1468,7 +1476,8 @@ void KX_Scene::LogicBeginFrame(double curtime) } //prepare obstacle simulation for new frame - m_obstacleSimulation->UpdateObstacles(); + if (m_obstacleSimulation) + m_obstacleSimulation->UpdateObstacles(); m_logicmgr->BeginFrame(curtime, 1.0/KX_KetsjiEngine::GetTicRate()); } @@ -1899,9 +1908,11 @@ PyMethodDef KX_Scene::Methods[] = { KX_PYMETHODTABLE(KX_Scene, replace), KX_PYMETHODTABLE(KX_Scene, suspend), KX_PYMETHODTABLE(KX_Scene, resume), + KX_PYMETHODTABLE(KX_Scene, drawObstacleSimulation), /* dict style access */ KX_PYMETHODTABLE(KX_Scene, get), + {NULL,NULL} //Sentinel }; @@ -2225,6 +2236,16 @@ KX_PYMETHODDEF_DOC(KX_Scene, resume, Py_RETURN_NONE; } +KX_PYMETHODDEF_DOC(KX_Scene, drawObstacleSimulation, + "drawObstacleSimulation()\n" + "Draw debug visualization of obstacle simulation.\n") +{ + if (GetObstacleSimulation()) + GetObstacleSimulation()->DrawObstacles(); + + Py_RETURN_NONE; +} + /* Matches python dict.get(key, [default]) */ KX_PYMETHODDEF_DOC(KX_Scene, get, "") { |