Python fixes:

Reenabled the setScript/getScript methods for python controller bricks.
Set the ray source point to MouseFocusSensor.getRaySource works.
Added: Python -> MT_Quaternion
MT_Matrix4x4, MT_Matrix3x3, MT_Vector3, MT_Point3 -> Python

Correct transform of frustum bound sphere centre point to world coordinates
This commit is contained in:
Kester Maddock
2004-05-26 12:09:17 +00:00
parent 3dd18c5c34
commit 8253d3e041
6 changed files with 174 additions and 14 deletions

View File

@@ -257,11 +257,11 @@ void KX_Camera::ExtractFrustumSphere()
// Compute centre
m_frustum_centre = MT_Point3(0., 0.,
(nearpoint.dot(nearpoint) - farpoint.dot(farpoint))/(2.0*(m_camdata.m_clipend - m_camdata.m_clipstart)));
-(nearpoint.dot(nearpoint) - farpoint.dot(farpoint))/(2.0*(m_camdata.m_clipend - m_camdata.m_clipstart)));
m_frustum_radius = m_frustum_centre.distance(farpoint);
// Transform to world space.
m_frustum_centre = GetCameraToWorld()(m_frustum_centre);
m_frustum_centre = GetWorldToCamera()(m_frustum_centre);
m_set_frustum_centre = true;
}
@@ -474,12 +474,14 @@ int KX_Camera::_setattr(const STR_String &attr, PyObject *pyvalue)
}
}
if (attr == "projection_matrix")
if (PyObject_IsMT_Matrix(pyvalue, 4))
{
PysetProjectionMatrix((PyObject*) this, pyvalue, NULL);
return 0;
if (attr == "projection_matrix")
{
SetProjectionMatrix(MT_Matrix4x4FromPyObject(pyvalue));
return 0;
}
}
return KX_GameObject::_setattr(attr, pyvalue);
}