BGE patch: rename rayCastToEx() to rayCast() - better name

This commit is contained in:
Benoit Bolsee 2008-05-24 22:50:31 +00:00
parent 7b069b9b60
commit e2a9590a15
3 changed files with 8 additions and 8 deletions

@ -743,7 +743,7 @@ PyMethodDef KX_GameObject::Methods[] = {
{"getPhysicsId", (PyCFunction)KX_GameObject::sPyGetPhysicsId,METH_VARARGS},
KX_PYMETHODTABLE(KX_GameObject, getDistanceTo),
KX_PYMETHODTABLE(KX_GameObject, rayCastTo),
KX_PYMETHODTABLE(KX_GameObject, rayCastToEx),
KX_PYMETHODTABLE(KX_GameObject, rayCast),
{NULL,NULL} //Sentinel
};
@ -1381,8 +1381,8 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo,
Py_Return;
}
KX_PYMETHODDEF_DOC(KX_GameObject, rayCastToEx,
"rayCastToEx(to,from,dist,prop): cast a ray and return tuple (object,hit,normal) of contact point with object within dist that matches prop or None if no hit\n"
KX_PYMETHODDEF_DOC(KX_GameObject, rayCast,
"rayCast(to,from,dist,prop): cast a ray and return tuple (object,hit,normal) of contact point with object within dist that matches prop or None if no hit\n"
" prop = property name that object must have; can be omitted => detect any object\n"
" dist = max distance to look (can be negative => look behind); 0 or omitted => detect up to to\n"
" from = 3-tuple or object reference for origin of ray (if object, use center of object)\n"

@ -665,7 +665,7 @@ public:
KX_PYMETHOD(KX_GameObject,RemoveParent);
KX_PYMETHOD(KX_GameObject,GetPhysicsId);
KX_PYMETHOD_DOC(KX_GameObject,rayCastTo);
KX_PYMETHOD_DOC(KX_GameObject,rayCastToEx);
KX_PYMETHOD_DOC(KX_GameObject,rayCast);
KX_PYMETHOD_DOC(KX_GameObject,getDistanceTo);
private :

@ -174,7 +174,7 @@ class KX_GameObject:
The ray is always casted from the center of the object, ignoring the object itself.
The ray is casted towards the center of another object or an explicit [x,y,z] point.
Use rayCastToEx() if you need to retrieve the hit point
Use rayCast() if you need to retrieve the hit point
@param other: [x,y,z] or object towards which the ray is casted
@type other: L{KX_GameObject} or 3-tuple
@ -185,13 +185,13 @@ class KX_GameObject:
@rtype: L{KX_GameObject}
@return: the first object hit or None if no object or object does not match prop
"""
def rayCastToEx(to,from,dist,prop):
def rayCast(to,from,dist,prop):
"""
Look from a point/object to another point/object and find first object hit within dist that matches prop.
Returns a 3-tuple with object reference, hit point and hit normal or (None,None,None) if no object hit.
Returns a 3-tuple with object reference, hit point and hit normal or (None,None,None) if no hit.
Ex:
# shoot along the axis gun-gunAim (gunAim should be collision-free)
ob,point,normal = gun.rayCastToEx(gunAim,None,50)
ob,point,normal = gun.rayCast(gunAim,None,50)
if ob:
# hit something