diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-08-30 03:41:09 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-08-30 03:41:09 +0400 |
commit | 75697c40a039e8f64573bedd5211c442e2af9e9c (patch) | |
tree | af111682037c4568eec377984005928046d867b6 /source/gameengine/Ketsji | |
parent | c2696ae63182da338d69a5127f03b1ad8b88f6c9 (diff) | |
parent | d7bf9688ac78169a37fbfc0d3d5bcd5b5be19170 (diff) |
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r22717:22875
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 8 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_PythonInit.cpp | 27 |
2 files changed, 3 insertions, 32 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 91213bee865..eeff39ab9b1 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -2520,12 +2520,10 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo, } } MT_Point3 fromPoint = NodeGetWorldPosition(); + if (dist != 0.0f) - { - MT_Vector3 toDir = toPoint-fromPoint; - toDir.normalize(); - toPoint = fromPoint + (dist) * toDir; - } + toPoint = fromPoint + dist * (toPoint-fromPoint).safe_normalized(); + PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment(); KX_IPhysicsController *spc = GetPhysicsController(); KX_GameObject *parent = GetParent(); diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 5afaf61dee2..67ab67814b2 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -448,32 +448,6 @@ static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *) } -static PyObject *gEvalExpression(PyObject*, PyObject* value) -{ - char* txt= _PyUnicode_AsString(value); - - if (txt==NULL) { - PyErr_SetString(PyExc_TypeError, "Expression.calc(text): expects a single string argument"); - return NULL; - } - - CParser parser; - CExpression* expr = parser.ProcessText(txt); - CValue* val = expr->Calculate(); - expr->Release(); - - if (val) { - PyObject* pyobj = val->ConvertValueToPython(); - if (pyobj) - return pyobj; - else - return val->GetProxy(); - } - - Py_RETURN_NONE; -} - - static struct PyMethodDef game_methods[] = { {"expandPath", (PyCFunction)gPyExpandPath, METH_VARARGS, (const char *)gPyExpandPath_doc}, {"sendMessage", (PyCFunction)gPySendMessage, METH_VARARGS, (const char *)gPySendMessage_doc}, @@ -500,7 +474,6 @@ static struct PyMethodDef game_methods[] = { {"getAverageFrameRate", (PyCFunction) gPyGetAverageFrameRate, METH_NOARGS, (const char *)"Gets the estimated average frame rate"}, {"getBlendFileList", (PyCFunction)gPyGetBlendFileList, METH_VARARGS, (const char *)"Gets a list of blend files in the same directory as the current blend file"}, {"PrintGLInfo", (PyCFunction)pyPrintExt, METH_NOARGS, (const char *)"Prints GL Extension Info"}, - {"EvalExpression", (PyCFunction)gEvalExpression, METH_O, (const char *)"Evaluate a string as a game logic expression"}, {NULL, (PyCFunction) NULL, 0, NULL } }; |