- BGE crash fix when casting a ray to the same location as the object from python.

- Incorrect Mathutils vector docstrings.
- last rayshade commit had an incomplete comment.
This commit is contained in:
Campbell Barton 2009-08-27 06:55:54 +00:00
parent 0db2975ff6
commit 324b3fbe74
3 changed files with 8 additions and 8 deletions

@ -58,8 +58,8 @@ struct PyMethodDef Vector_methods[] = {
{"normalize", (PyCFunction) Vector_Normalize, METH_NOARGS, Vector_Normalize_doc}, {"normalize", (PyCFunction) Vector_Normalize, METH_NOARGS, Vector_Normalize_doc},
{"negate", (PyCFunction) Vector_Negate, METH_NOARGS, Vector_Negate_doc}, {"negate", (PyCFunction) Vector_Negate, METH_NOARGS, Vector_Negate_doc},
{"resize2D", (PyCFunction) Vector_Resize2D, METH_NOARGS, Vector_Resize2D_doc}, {"resize2D", (PyCFunction) Vector_Resize2D, METH_NOARGS, Vector_Resize2D_doc},
{"resize3D", (PyCFunction) Vector_Resize3D, METH_NOARGS, Vector_Resize2D_doc}, {"resize3D", (PyCFunction) Vector_Resize3D, METH_NOARGS, Vector_Resize3D_doc},
{"resize4D", (PyCFunction) Vector_Resize4D, METH_NOARGS, Vector_Resize2D_doc}, {"resize4D", (PyCFunction) Vector_Resize4D, METH_NOARGS, Vector_Resize4D_doc},
{"toTrackQuat", ( PyCFunction ) Vector_ToTrackQuat, METH_VARARGS, Vector_ToTrackQuat_doc}, {"toTrackQuat", ( PyCFunction ) Vector_ToTrackQuat, METH_VARARGS, Vector_ToTrackQuat_doc},
{"reflect", ( PyCFunction ) Vector_Reflect, METH_O, Vector_Reflect_doc}, {"reflect", ( PyCFunction ) Vector_Reflect, METH_O, Vector_Reflect_doc},
{"cross", ( PyCFunction ) Vector_Cross, METH_O, Vector_Dot_doc}, {"cross", ( PyCFunction ) Vector_Cross, METH_O, Vector_Dot_doc},

@ -1240,7 +1240,9 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
if(shi->combinedflag & SCE_PASS_REFLECT) { if(shi->combinedflag & SCE_PASS_REFLECT) {
/* values in shr->spec can be greater then 1.0. /* values in shr->spec can be greater then 1.0.
* in the case when it is 1.0 diff */ * In this case the mircol uses a zero blending factor, so ignoring it is ok.
* Fixes bug #18837 - when the spec is higher then 1.0,
* diff can become a negative color - Campbell */
f1= 1.0f-i; f1= 1.0f-i;

@ -2597,12 +2597,10 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo,
} }
} }
MT_Point3 fromPoint = NodeGetWorldPosition(); MT_Point3 fromPoint = NodeGetWorldPosition();
if (dist != 0.0f) if (dist != 0.0f)
{ toPoint = fromPoint + dist * (toPoint-fromPoint).safe_normalized();
MT_Vector3 toDir = toPoint-fromPoint;
toDir.normalize();
toPoint = fromPoint + (dist) * toDir;
}
PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment(); PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
KX_IPhysicsController *spc = GetPhysicsController(); KX_IPhysicsController *spc = GetPhysicsController();
KX_GameObject *parent = GetParent(); KX_GameObject *parent = GetParent();