Patch #8740: enable negative axis radar sensor

This commit is contained in:
Benoit Bolsee 2008-04-05 22:08:15 +00:00
parent 6e5984ce39
commit 9edb6c7510
2 changed files with 31 additions and 15 deletions

@ -1096,18 +1096,13 @@ static short draw_sensorbuttons(bSensor *sens, uiBlock *block, short xco, short
(short)(10+xco),(short)(yco-44), (short)(0.7 * (width-20)), 19,
&rs->name, 0, 31, 0, 0,
"Only look for Objects with this property");
uiDefButS(block, ROW, 1, "X",
(short)(10+xco+0.7 * (width-20)),(short)(yco-44), (short)(0.1 * (width-22)),19,
&rs->axis, 2.0, 0, 0, 0,
"Cast the cone along the object's positive x-axis");
uiDefButS(block, ROW, 1, "Y",
(short)(10+xco+0.8 * (width-20)),(short)(yco-44),(short)(0.1 * (width-22)), 19,
&rs->axis, 2.0, 1, 0, 0,
"Cast the cone along the object's positive y-axis");
uiDefButS(block, ROW, 1, "Z",
(short)(10+xco+0.9 * (width-20)), (short)(yco-44), (short)(0.1 * (width-22)), 19,
&rs->axis, 2.0, 2, 0, 0,
"Cast the cone along the object's positive z-axis");
str = "Type %t|+X axis %x0|+Y axis %x1|+Z axis %x2|-X axis %x3|-Y axis %x4|-Z axis %x5";
uiDefButS(block, MENU, B_REDR, str,
(short)(10+xco+0.7 * (width-20)), (short)(yco-44), (short)(0.3 * (width-22)), 19,
&rs->axis, 2.0, 31, 0, 0,
"Specify along which axis the radar cone is cast.");
uiDefButF(block, NUM, 1, "Ang:",
(short)(10+xco), (short)(yco-68), (short)((width-20)/2), 19,
&rs->angle, 0.0, 179.9, 10, 0,

@ -127,27 +127,48 @@ void KX_RadarSensor::SynchronizeTransform()
// depends on the radar 'axis'
switch (m_axis)
{
case 0: // X Axis
case 0: // +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 1: // +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 2: // +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
{
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
{
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
{
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;
};
default:
{
}