From 0fbca1dc19afaa034377d5aeed10fa8c25e2a102 Mon Sep 17 00:00:00 2001 From: Nick Samarin Date: Thu, 15 Jul 2010 18:41:29 +0000 Subject: [PATCH] - added options to enable visualization for obstacle simulation and steering actuator - added python attributes for parameters of steering actuator --- release/scripts/ui/properties_game.py | 3 +- source/blender/blenlib/BLI_math_vector.h | 2 +- .../blenlib/intern/math_vector_inline.c | 2 +- .../editors/space_logic/logic_window.c | 4 ++ source/blender/makesdna/DNA_actuator_types.h | 1 + source/blender/makesdna/DNA_scene_types.h | 1 + source/blender/makesrna/intern/rna_actuator.c | 5 ++ source/blender/makesrna/intern/rna_scene.c | 4 ++ .../Converter/KX_ConvertActuators.cpp | 3 +- source/gameengine/Ketsji/KX_NavMeshObject.cpp | 48 ++++++++++--- source/gameengine/Ketsji/KX_NavMeshObject.h | 7 +- .../Ketsji/KX_ObstacleSimulation.cpp | 9 ++- .../gameengine/Ketsji/KX_ObstacleSimulation.h | 5 +- source/gameengine/Ketsji/KX_Scene.cpp | 5 +- .../gameengine/Ketsji/KX_SteeringActuator.cpp | 68 +++++++++++++++---- .../gameengine/Ketsji/KX_SteeringActuator.h | 23 ++++--- 16 files changed, 144 insertions(+), 46 deletions(-) diff --git a/release/scripts/ui/properties_game.py b/release/scripts/ui/properties_game.py index 964a8076534..e581d7f1e3c 100644 --- a/release/scripts/ui/properties_game.py +++ b/release/scripts/ui/properties_game.py @@ -557,7 +557,8 @@ class WORLD_PT_game_physics_obstacles(WorldButtonsPanel): layout.prop(gs, "obstacle_simulation", text = "Type") if gs.obstacle_simulation != 'None': - layout.prop(gs, "level_height", text="Level height") + layout.prop(gs, "level_height") + layout.prop(gs, "show_obstacle_simulation") classes = [ diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 02d5fb27dc9..e27b71f9301 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -121,7 +121,7 @@ void mid_v3_v3v3(float r[3], float a[3], float b[3]); MINLINE int is_zero_v3(float a[3]); MINLINE int is_one_v3(float a[3]); -MINLINE int equals_v3v3(float a[3], float b[3]); +MINLINE int equals_v3v3(const float a[3],const float b[3]); MINLINE int compare_v3v3(float a[3], float b[3], float limit); MINLINE int compare_len_v3v3(float a[3], float b[3], float limit); diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index fa8d1a30269..aa72be4fcc2 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -404,7 +404,7 @@ MINLINE int is_one_v3(float *v) return (v[0] == 1 && v[1] == 1 && v[2] == 1); } -MINLINE int equals_v3v3(float *v1, float *v2) +MINLINE int equals_v3v3(const float *v1,const float *v2) { return ((v1[0]==v2[0]) && (v1[1]==v2[1]) && (v1[2]==v2[2])); } diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 8a011184f0d..22921f41ae9 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -4324,7 +4324,11 @@ static void draw_actuator_steering(uiLayout *layout, PointerRNA *ptr) row = uiLayoutRow(layout, 0); uiItemR(row, ptr, "selfterminated", 0, NULL, 0); if (RNA_enum_get(ptr, "mode")==ACT_STEERING_PATHFOLLOWING) + { uiItemR(row, ptr, "updateperiod", 0, NULL, 0); + row = uiLayoutRow(layout, 0); + } + uiItemR(row, ptr, "enablevisualization", 0, NULL, 0); } diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h index 9d26632769b..f3e8dc93cfd 100644 --- a/source/blender/makesdna/DNA_actuator_types.h +++ b/source/blender/makesdna/DNA_actuator_types.h @@ -522,6 +522,7 @@ typedef struct FreeCamera { #define ACT_STEERING_PATHFOLLOWING 2 /* steeringactuator->flag */ #define ACT_STEERING_SELFTERMINATED 1 +#define ACT_STEERING_ENABLEVISUALIZATION 2 #endif diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 2fa08c663c1..72044513300 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -516,6 +516,7 @@ typedef struct GameData { #define GAME_GLSL_NO_EXTRA_TEX (1 << 11) #define GAME_IGNORE_DEPRECATION_WARNINGS (1 << 12) #define GAME_ENABLE_ANIMATION_RECORD (1 << 13) +#define GAME_SHOW_OBSTACLE_SIMULATION (1 << 14) /* GameData.matmode */ #define GAME_MAT_TEXFACE 0 diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index b78eb766151..fdd017873e7 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -1926,6 +1926,11 @@ static void rna_def_steering_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Self terminated", "Terminate when target is reached"); RNA_def_property_update(prop, NC_LOGIC, NULL); + prop= RNA_def_property(srna, "enablevisualization", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_STEERING_ENABLEVISUALIZATION); + RNA_def_property_ui_text(prop, "Visualize", "Enable debug visualization"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + prop= RNA_def_property(srna, "updateperiod", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "updateTime"); RNA_def_property_ui_range(prop, -1, 100000, 1, 1); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 23b4596828c..3dc10530242 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1862,6 +1862,10 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Level height", "Max difference in heights of obstacles to enable their interaction"); RNA_def_property_update(prop, NC_SCENE, NULL); + prop= RNA_def_property(srna, "show_obstacle_simulation", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_OBSTACLE_SIMULATION); + RNA_def_property_ui_text(prop, "Visualization", "Enable debug visualization for obstacle simulation"); + /* Recast Settings */ prop= RNA_def_property(srna, "recast_data", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index e5c39da1545..2c6dab910d8 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -1058,11 +1058,12 @@ void BL_ConvertActuators(char* maggiename, } bool selfTerminated = (stAct->flag & ACT_STEERING_SELFTERMINATED) !=0; + bool enableVisualization = (stAct->flag & ACT_STEERING_ENABLEVISUALIZATION) !=0; KX_SteeringActuator *tmpstact = new KX_SteeringActuator(gameobj, mode, targetob, navmeshob,stAct->dist, stAct->velocity, stAct->acceleration, stAct->turnspeed, selfTerminated, stAct->updateTime, - scene->GetObstacleSimulation()); + scene->GetObstacleSimulation(), enableVisualization); baseact = tmpstact; break; } diff --git a/source/gameengine/Ketsji/KX_NavMeshObject.cpp b/source/gameengine/Ketsji/KX_NavMeshObject.cpp index b4e2c753832..63d84d0c028 100644 --- a/source/gameengine/Ketsji/KX_NavMeshObject.cpp +++ b/source/gameengine/Ketsji/KX_NavMeshObject.cpp @@ -446,6 +446,13 @@ bool KX_NavMeshObject::BuildVertIndArrays(RAS_MeshObject* meshobj, float *&verti bool KX_NavMeshObject::BuildNavMesh() { + if (m_navMesh) + { + delete m_navMesh; + m_navMesh = NULL; + } + + if (GetMeshCount()==0) return false; @@ -628,25 +635,23 @@ dtStatNavMesh* KX_NavMeshObject::GetNavMesh() return m_navMesh; } -void KX_NavMeshObject::DrawNavMesh() +void KX_NavMeshObject::DrawNavMesh(NavMeshRenderMode renderMode) { if (!m_navMesh) return; MT_Vector3 color(0.f, 0.f, 0.f); - enum RenderMode {POLYS ,DETAILED_TRIS, WALLS}; - static const RenderMode renderMode = DETAILED_TRIS;// DETAILED_TRIS POLYS switch (renderMode) { - case POLYS : - case WALLS : + case RM_POLYS : + case RM_WALLS : for (int pi=0; pigetPolyCount(); pi++) { const dtStatPoly* poly = m_navMesh->getPoly(pi); for (int i = 0, j = (int)poly->nv-1; i < (int)poly->nv; j = i++) { - if (poly->n[j] && renderMode==WALLS) + if (poly->n[j] && renderMode==RM_WALLS) continue; const float* vif = m_navMesh->getVertex(poly->v[i]); const float* vjf = m_navMesh->getVertex(poly->v[j]); @@ -658,7 +663,7 @@ void KX_NavMeshObject::DrawNavMesh() } } break; - case DETAILED_TRIS : + case RM_TRIS : for (int i = 0; i < m_navMesh->getPolyDetailCount(); ++i) { const dtStatPoly* p = m_navMesh->getPoly(i); @@ -800,7 +805,7 @@ PyTypeObject KX_NavMeshObject::Type = { Methods, 0, 0, - &CValue::Type, + &KX_GameObject::Type, 0,0,0,0,0,0, py_base_new }; @@ -814,6 +819,7 @@ PyMethodDef KX_NavMeshObject::Methods[] = { KX_PYMETHODTABLE(KX_NavMeshObject, findPath), KX_PYMETHODTABLE(KX_NavMeshObject, raycast), KX_PYMETHODTABLE(KX_NavMeshObject, draw), + KX_PYMETHODTABLE(KX_NavMeshObject, rebuild), {NULL,NULL} //Sentinel }; @@ -854,10 +860,30 @@ KX_PYMETHODDEF_DOC(KX_NavMeshObject, raycast, return PyFloat_FromDouble(hit); } -KX_PYMETHODDEF_DOC_NOARGS(KX_NavMeshObject, draw, - "draw(): navigation mesh debug drawing\n") +KX_PYMETHODDEF_DOC(KX_NavMeshObject, draw, + "draw(mode): navigation mesh debug drawing\n" + "mode: WALLS, POLYS, TRIS\n") { - DrawNavMesh(); + char* mode; + NavMeshRenderMode renderMode = RM_TRIS; + if (PyArg_ParseTuple(args,"s:rebuild",&mode)) + { + STR_String mode_str(mode); + if (mode_str.IsEqualNoCase("WALLS")) + renderMode = RM_WALLS; + else if (mode_str.IsEqualNoCase("POLYS")) + renderMode = RM_POLYS; + else if (mode_str.IsEqualNoCase("TRIS")) + renderMode = RM_TRIS; + } + DrawNavMesh(renderMode); + Py_RETURN_NONE; +} + +KX_PYMETHODDEF_DOC_NOARGS(KX_NavMeshObject, rebuild, + "rebuild(): rebuild navigation mesh\n") +{ + BuildNavMesh(); Py_RETURN_NONE; } diff --git a/source/gameengine/Ketsji/KX_NavMeshObject.h b/source/gameengine/Ketsji/KX_NavMeshObject.h index f06cd3b455d..d7b0fe033c2 100644 --- a/source/gameengine/Ketsji/KX_NavMeshObject.h +++ b/source/gameengine/Ketsji/KX_NavMeshObject.h @@ -60,7 +60,9 @@ public: dtStatNavMesh* GetNavMesh(); int FindPath(const MT_Point3& from, const MT_Point3& to, float* path, int maxPathLen); float Raycast(const MT_Point3& from, const MT_Point3& to); - void DrawNavMesh(); + + enum NavMeshRenderMode {RM_WALLS, RM_POLYS, RM_TRIS}; + void DrawNavMesh(NavMeshRenderMode mode); void DrawPath(const float *path, int pathLen, const MT_Vector3& color); MT_Point3 TransformToLocalCoords(const MT_Point3& wpos); @@ -72,7 +74,8 @@ public: KX_PYMETHOD_DOC(KX_NavMeshObject, findPath); KX_PYMETHOD_DOC(KX_NavMeshObject, raycast); - KX_PYMETHOD_DOC_NOARGS(KX_NavMeshObject, draw); + KX_PYMETHOD_DOC(KX_NavMeshObject, draw); + KX_PYMETHOD_DOC_NOARGS(KX_NavMeshObject, rebuild); #endif }; diff --git a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp index 14487a2e75c..dcaadd23e3f 100644 --- a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp +++ b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp @@ -166,8 +166,9 @@ static float interpolateToi(float a, const float* dir, const float* toi, const i return 0; } -KX_ObstacleSimulation::KX_ObstacleSimulation(MT_Scalar levelHeight) +KX_ObstacleSimulation::KX_ObstacleSimulation(MT_Scalar levelHeight, bool enableVisualization) : m_levelHeight(levelHeight) +, m_enableVisualization(enableVisualization) { } @@ -276,6 +277,8 @@ void KX_ObstacleSimulation::AdjustObstacleVelocity(KX_Obstacle* activeObst, KX_N void KX_ObstacleSimulation::DrawObstacles() { + if (!m_enableVisualization) + return; static const MT_Vector3 bluecolor(0,0,1); static const MT_Vector3 normal(0.,0.,1.); static const int SECTORS_NUM = 32; @@ -341,8 +344,8 @@ bool KX_ObstacleSimulation::FilterObstacle(KX_Obstacle* activeObst, KX_NavMeshOb return true; } -KX_ObstacleSimulationTOI::KX_ObstacleSimulationTOI(MT_Scalar levelHeight): - KX_ObstacleSimulation(levelHeight), +KX_ObstacleSimulationTOI::KX_ObstacleSimulationTOI(MT_Scalar levelHeight, bool enableVisualization): + KX_ObstacleSimulation(levelHeight, enableVisualization), m_avoidSteps(32), m_minToi(0.5f), m_maxToi(1.2f), diff --git a/source/gameengine/Ketsji/KX_ObstacleSimulation.h b/source/gameengine/Ketsji/KX_ObstacleSimulation.h index c5b9a154c3b..b084f54d3b8 100644 --- a/source/gameengine/Ketsji/KX_ObstacleSimulation.h +++ b/source/gameengine/Ketsji/KX_ObstacleSimulation.h @@ -74,11 +74,12 @@ protected: std::vector m_obstacles; MT_Scalar m_levelHeight; + bool m_enableVisualization; virtual KX_Obstacle* CreateObstacle(KX_GameObject* gameobj); bool FilterObstacle(KX_Obstacle* activeObstacle, KX_NavMeshObject* activeNavMeshObj, KX_Obstacle* otherObstacle); public: - KX_ObstacleSimulation(MT_Scalar levelHeight); + KX_ObstacleSimulation(MT_Scalar levelHeight, bool enableVisualization); virtual ~KX_ObstacleSimulation(); void DrawObstacles(); @@ -117,7 +118,7 @@ protected: std::vector m_toiCircles; // TOI circles (one per active agent) virtual KX_Obstacle* CreateObstacle(KX_GameObject* gameobj); public: - KX_ObstacleSimulationTOI(MT_Scalar levelHeight); + KX_ObstacleSimulationTOI(MT_Scalar levelHeight, bool enableVisualization); ~KX_ObstacleSimulationTOI(); virtual void AdjustObstacleVelocity(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, MT_Vector3& velocity, MT_Scalar maxDeltaSpeed,MT_Scalar maxDeltaAngle); diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 950b1ea793d..5c002de6358 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -210,11 +210,12 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice, m_rootnode = NULL; m_bucketmanager=new RAS_BucketManager(); - + bool showObstacleSimulation = scene->gm.flag & GAME_SHOW_OBSTACLE_SIMULATION; switch (scene->gm.obstacleSimulation) { case OBSTSIMULATION_TOI: - m_obstacleSimulation = new KX_ObstacleSimulationTOI((MT_Scalar)scene->gm.levelHeight); + + m_obstacleSimulation = new KX_ObstacleSimulationTOI((MT_Scalar)scene->gm.levelHeight, showObstacleSimulation); break; default: m_obstacleSimulation = NULL; diff --git a/source/gameengine/Ketsji/KX_SteeringActuator.cpp b/source/gameengine/Ketsji/KX_SteeringActuator.cpp index b733fc79dee..2153227f0c6 100644 --- a/source/gameengine/Ketsji/KX_SteeringActuator.cpp +++ b/source/gameengine/Ketsji/KX_SteeringActuator.cpp @@ -48,13 +48,14 @@ KX_SteeringActuator::KX_SteeringActuator(SCA_IObject *gameobj, int mode, KX_GameObject *target, KX_GameObject *navmesh, - MT_Scalar distance, - MT_Scalar velocity, - MT_Scalar acceleration, - MT_Scalar turnspeed, + float distance, + float velocity, + float acceleration, + float turnspeed, bool isSelfTerminated, int pathUpdatePeriod, - KX_ObstacleSimulation* simulation) : + KX_ObstacleSimulation* simulation, + bool enableVisualization) : SCA_IActuator(gameobj, KX_ACT_STEERING), m_mode(mode), m_target(target), @@ -67,6 +68,7 @@ KX_SteeringActuator::KX_SteeringActuator(SCA_IObject *gameobj, m_updateTime(0), m_isActive(false), m_simulation(simulation), + m_enableVisualization(enableVisualization), m_obstacle(NULL), m_pathLen(0), m_wayPointIdx(-1) @@ -111,13 +113,11 @@ bool KX_SteeringActuator::UnlinkObject(SCA_IObject* clientobj) { if (clientobj == m_target) { - // this object is being deleted, we cannot continue to use it. m_target = NULL; return true; } else if (clientobj == m_navmesh) { - // this object is being deleted, we cannot continue to useit. m_navmesh = NULL; return true; } @@ -229,10 +229,13 @@ bool KX_SteeringActuator::Update(double curtime, bool frame) steervec = waypoint - mypos; apply_steerforce = true; - //debug draw - static const MT_Vector3 PATH_COLOR(1,0,0); - m_navmesh->DrawPath(m_path, m_pathLen, PATH_COLOR); - + + if (m_enableVisualization) + { + //debug draw + static const MT_Vector3 PATH_COLOR(1,0,0); + m_navmesh->DrawPath(m_path, m_pathLen, PATH_COLOR); + } } } @@ -251,10 +254,12 @@ bool KX_SteeringActuator::Update(double curtime, bool frame) //adjust velocity to avoid obstacles if (m_simulation && m_obstacle && !newvel.fuzzyZero()) { - KX_RasterizerDrawDebugLine(mypos, mypos + newvel, MT_Vector3(1.,0.,0.)); + if (m_enableVisualization) + KX_RasterizerDrawDebugLine(mypos, mypos + newvel, MT_Vector3(1.,0.,0.)); m_simulation->AdjustObstacleVelocity(m_obstacle, m_mode!=KX_STEERING_PATHFOLLOWING ? m_navmesh : NULL, newvel, m_acceleration*delta, m_turnspeed/180.0f*M_PI*delta); - KX_RasterizerDrawDebugLine(mypos, mypos + newvel, MT_Vector3(0.,1.,0.)); + if (m_enableVisualization) + KX_RasterizerDrawDebugLine(mypos, mypos + newvel, MT_Vector3(0.,1.,0.)); } if (isdyna) @@ -313,7 +318,16 @@ PyMethodDef KX_SteeringActuator::Methods[] = { }; PyAttributeDef KX_SteeringActuator::Attributes[] = { + KX_PYATTRIBUTE_INT_RW("bevaiour", KX_STEERING_NODEF+1, KX_STEERING_MAX-1, true, KX_SteeringActuator, m_mode), KX_PYATTRIBUTE_RW_FUNCTION("target", KX_SteeringActuator, pyattr_get_target, pyattr_set_target), + KX_PYATTRIBUTE_RW_FUNCTION("navmesh", KX_SteeringActuator, pyattr_get_navmesh, pyattr_set_navmesh), + KX_PYATTRIBUTE_FLOAT_RW("distance", 0.0f, 1000.0f, KX_SteeringActuator, m_distance), + KX_PYATTRIBUTE_FLOAT_RW("velocity", 0.0f, 1000.0f, KX_SteeringActuator, m_velocity), + KX_PYATTRIBUTE_FLOAT_RW("acceleration", 0.0f, 1000.0f, KX_SteeringActuator, m_acceleration), + KX_PYATTRIBUTE_FLOAT_RW("turnspeed", 0.0f, 720.0f, KX_SteeringActuator, m_turnspeed), + KX_PYATTRIBUTE_BOOL_RW("selfterminated", KX_SteeringActuator, m_isSelfTerminated), + KX_PYATTRIBUTE_BOOL_RW("enableVisualization", KX_SteeringActuator, m_enableVisualization), + KX_PYATTRIBUTE_INT_RW("pathUpdatePeriod", -1, 100000, true, KX_SteeringActuator, m_pathUpdatePeriod), { NULL } //Sentinel }; @@ -345,6 +359,34 @@ int KX_SteeringActuator::pyattr_set_target(void *self, const struct KX_PYATTRIBU return PY_SET_ATTR_SUCCESS; } +PyObject* KX_SteeringActuator::pyattr_get_navmesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_SteeringActuator* actuator = static_cast(self); + if (!actuator->m_navmesh) + Py_RETURN_NONE; + else + return actuator->m_navmesh->GetProxy(); +} + +int KX_SteeringActuator::pyattr_set_navmesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + KX_SteeringActuator* actuator = static_cast(self); + KX_GameObject *gameobj; + + if (!ConvertPythonToGameObject(value, &gameobj, true, "actuator.object = value: KX_SteeringActuator")) + return PY_SET_ATTR_FAIL; // ConvertPythonToGameObject sets the error + + if (actuator->m_navmesh != NULL) + actuator->m_navmesh->UnregisterActuator(actuator); + + actuator->m_navmesh = dynamic_cast(gameobj); + + if (actuator->m_navmesh) + actuator->m_navmesh->RegisterActuator(actuator); + + return PY_SET_ATTR_SUCCESS; +} + #endif // DISABLE_PYTHON /* eof */ diff --git a/source/gameengine/Ketsji/KX_SteeringActuator.h b/source/gameengine/Ketsji/KX_SteeringActuator.h index 5ac5a9f37c4..b07d906dba3 100644 --- a/source/gameengine/Ketsji/KX_SteeringActuator.h +++ b/source/gameengine/Ketsji/KX_SteeringActuator.h @@ -53,16 +53,17 @@ class KX_SteeringActuator : public SCA_IActuator KX_GameObject *m_target; KX_NavMeshObject *m_navmesh; int m_mode; - MT_Scalar m_distance; - MT_Scalar m_velocity; - MT_Scalar m_acceleration; - MT_Scalar m_turnspeed; + float m_distance; + float m_velocity; + float m_acceleration; + float m_turnspeed; KX_ObstacleSimulation* m_simulation; KX_Obstacle* m_obstacle; double m_updateTime; bool m_isActive; bool m_isSelfTerminated; + bool m_enableVisualization; float m_path[MAX_PATH_LENGTH*3]; int m_pathLen; int m_pathUpdatePeriod; @@ -82,13 +83,14 @@ public: int mode, KX_GameObject *target, KX_GameObject *navmesh, - MT_Scalar distance, - MT_Scalar velocity, - MT_Scalar acceleration, - MT_Scalar turnspeed, + float distance, + float velocity, + float acceleration, + float turnspeed, bool isSelfTerminated, int pathUpdatePeriod, - KX_ObstacleSimulation* simulation); + KX_ObstacleSimulation* simulation, + bool enableVisualization); virtual ~KX_SteeringActuator(); virtual bool Update(double curtime, bool frame); @@ -106,6 +108,9 @@ public: /* These are used to get and set m_target */ static PyObject* pyattr_get_target(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_target(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + static PyObject* pyattr_get_navmesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); + static int pyattr_set_navmesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + #endif // DISABLE_PYTHON