diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2010-11-26 06:37:08 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2010-11-26 06:37:08 +0300 |
commit | 9d9a88348e2f9d1770e4dd7d44df3491489b3ded (patch) | |
tree | d04254b7294384f8d06e3bf38d103ee24544f68b /source/gameengine | |
parent | 886e7a7f45b7b662f724092bce42e546e8081397 (diff) |
BGE Bugfix: [#24926] Sensor 'Radar' les axes X+ et Y+ ont été inversé. (oui, a french bug report :)
we were using SENSOR_RAY for the radar sensor axis. However the Ray axis is inverted (God knows why) so I created a set of defines only for radar sensor.
Also I thought it was a good idea to replace some hardcoded values in Radar and Ray codes by their defines in DNA_sensor_types.h (similar to what Benoit did for Armature Sensor, so I see no problem on that).
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Ketsji/KX_RadarSensor.cpp | 13 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_RaySensor.cpp | 13 |
2 files changed, 14 insertions, 12 deletions
diff --git a/source/gameengine/Ketsji/KX_RadarSensor.cpp b/source/gameengine/Ketsji/KX_RadarSensor.cpp index 60dc3be7d6e..7cbdd3bba66 100644 --- a/source/gameengine/Ketsji/KX_RadarSensor.cpp +++ b/source/gameengine/Ketsji/KX_RadarSensor.cpp @@ -31,6 +31,7 @@ #include "KX_PyMath.h" #include "PHY_IPhysicsController.h" #include "PHY_IMotionState.h" +#include "DNA_sensor_types.h" /** * RadarSensor constructor. Creates a near-sensor derived class, with a cone collision shape. @@ -95,42 +96,42 @@ void KX_RadarSensor::SynchronizeTransform() // depends on the radar 'axis' switch (m_axis) { - case 0: // +X Axis + case SENS_RADAR_X_AXIS: // +X Axis { MT_Quaternion rotquatje(MT_Vector3(0,0,1),MT_radians(90)); trans.rotate(rotquatje); trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0)); break; }; - case 1: // +Y Axis + case SENS_RADAR_Y_AXIS: // +Y Axis { MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-180)); trans.rotate(rotquatje); trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0)); break; }; - case 2: // +Z Axis + case SENS_RADAR_Z_AXIS: // +Z Axis { MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-90)); trans.rotate(rotquatje); trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0)); break; }; - case 3: // -X Axis + case SENS_RADAR_NEG_X_AXIS: // -X Axis { MT_Quaternion rotquatje(MT_Vector3(0,0,1),MT_radians(-90)); trans.rotate(rotquatje); trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0)); break; }; - case 4: // -Y Axis + case SENS_RADAR_NEG_Y_AXIS: // -Y Axis { //MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-180)); //trans.rotate(rotquatje); trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0)); break; }; - case 5: // -Z Axis + case SENS_RADAR_NEG_Z_AXIS: // -Z Axis { MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(90)); trans.rotate(rotquatje); diff --git a/source/gameengine/Ketsji/KX_RaySensor.cpp b/source/gameengine/Ketsji/KX_RaySensor.cpp index 001c7a290d7..2434c031a6a 100644 --- a/source/gameengine/Ketsji/KX_RaySensor.cpp +++ b/source/gameengine/Ketsji/KX_RaySensor.cpp @@ -42,6 +42,7 @@ #include "PHY_IPhysicsEnvironment.h" #include "KX_IPhysicsController.h" #include "PHY_IPhysicsController.h" +#include "DNA_sensor_types.h" #include <stdio.h> @@ -198,42 +199,42 @@ bool KX_RaySensor::Evaluate() m_reset = false; switch (m_axis) { - case 1: // X + case SENS_RAY_X_AXIS: // X { todir[0] = invmat[0][0]; todir[1] = invmat[0][1]; todir[2] = invmat[0][2]; break; } - case 0: // Y + case SENS_RAY_Y_AXIS: // Y { todir[0] = invmat[1][0]; todir[1] = invmat[1][1]; todir[2] = invmat[1][2]; break; } - case 2: // Z + case SENS_RAY_Z_AXIS: // Z { todir[0] = invmat[2][0]; todir[1] = invmat[2][1]; todir[2] = invmat[2][2]; break; } - case 3: // -X + case SENS_RAY_NEG_X_AXIS: // -X { todir[0] = -invmat[0][0]; todir[1] = -invmat[0][1]; todir[2] = -invmat[0][2]; break; } - case 4: // -Y + case SENS_RAY_NEG_Y_AXIS: // -Y { todir[0] = -invmat[1][0]; todir[1] = -invmat[1][1]; todir[2] = -invmat[1][2]; break; } - case 5: // -Z + case SENS_RAY_NEG_Z_AXIS: // -Z { todir[0] = -invmat[2][0]; todir[1] = -invmat[2][1]; |