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_ObstacleSimulation.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_ObstacleSimulation.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_ObstacleSimulation.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp index 1d0b0b40750..bad38513167 100644 --- a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp +++ b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp @@ -36,8 +36,11 @@ #include "KX_NavMeshObject.h" #include "KX_PythonInit.h" #include "DNA_object_types.h" -#include "math.h" -#define M_PI 3.14159265358979323846 +#include <math.h> + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif int sweepCircleCircle(const MT_Vector3& pos0, const MT_Scalar r0, const MT_Vector2& v, const MT_Vector3& pos1, const MT_Scalar r1, @@ -168,7 +171,7 @@ void KX_ObstacleSimulation::AddObstacleForObj(KX_GameObject* gameobj) struct Object* blenderobject = gameobj->GetBlenderObject(); obstacle->m_type = KX_OBSTACLE_OBJ; obstacle->m_shape = KX_OBSTACLE_CIRCLE; - obstacle->m_rad = blenderobject->inertia; //.todo use radius of collision shape bound sphere + obstacle->m_rad = blenderobject->obstacleRad; obstacle->m_gameObj = gameobj; } @@ -235,12 +238,21 @@ void KX_ObstacleSimulation::AdjustObstacleVelocity(KX_Obstacle* activeObst, KX_N void KX_ObstacleSimulation::DrawObstacles() { static const MT_Vector3 bluecolor(0,0,1); + static const MT_Vector3 normal(0.,0.,1.); + static const int SECTORS_NUM = 32; for (size_t i=0; i<m_obstacles.size(); i++) { if (m_obstacles[i]->m_shape==KX_OBSTACLE_SEGMENT) { KX_RasterizerDrawDebugLine(m_obstacles[i]->m_pos, m_obstacles[i]->m_pos2, bluecolor); } +/* + else if (m_obstacles[i]->m_shape==KX_OBSTACLE_CIRCLE) + { + KX_RasterizerDrawDebugCircle(m_obstacles[i]->m_pos, m_obstacles[i]->m_rad, bluecolor, + normal.normalized(), SECTORS_NUM); + }*/ + } } |