Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2008-03-15 20:08:58 +0300
committerBenoit Bolsee <benoit.bolsee@online.be>2008-03-15 20:08:58 +0300
commit435a49dfe7c5f6933c7e07cb06154dfcabeaf09e (patch)
tree2b4a4117a23581c77c02e4ba2eb6db5b0d6a7985 /source/gameengine/Ketsji/KX_GameObject.h
parentd0b36bfeaab7949060cb6657ce8d52f007bf54cd (diff)
New rayCastTo() python method for KX_GameObject:
rayCastTo(other,dist,prop) Look towards another point/KX_GameObject and return first object hit within dist with a property that match prop, None if no object found or if it does not match prop. Parameters: other = 3-tuple (xyz coordinates) or object reference (target=center of object) (type = list [x,y,z] or object reference) dist = max distance of detection (can be negative => look behind) If 0 or omitted => detect up to other (type=float) prop = property name that object must have If empty or omitted => detect any object (type=string)
Diffstat (limited to 'source/gameengine/Ketsji/KX_GameObject.h')
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index db910a46a81..945b769d8be 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -57,6 +57,7 @@
struct KX_ClientObjectInfo;
class RAS_MeshObject;
class KX_IPhysicsController;
+class PHY_IPhysicsEnvironment;
/**
@@ -82,6 +83,11 @@ protected:
bool m_bVisible;
KX_IPhysicsController* m_pPhysicsController1;
+ // used for ray casting
+ PHY_IPhysicsEnvironment* m_pPhysicsEnvironment;
+ STR_String m_testPropName;
+ KX_GameObject* m_pHitObject;
+
SG_Node* m_pSGNode;
MT_CmMatrix4x4 m_OpenGL_4x4Matrix;
@@ -262,6 +268,19 @@ public:
/**
+ * @return a pointer to the physics environment in use during the game, for rayCasting
+ */
+ PHY_IPhysicsEnvironment* GetPhysicsEnvironment()
+ {
+ return m_pPhysicsEnvironment;
+ }
+
+ void SetPhysicsEnvironment(PHY_IPhysicsEnvironment* physicsEnvironment)
+ {
+ m_pPhysicsEnvironment = physicsEnvironment;
+ }
+
+ /**
* @return a pointer to the physics controller owned by this class.
*/
@@ -341,6 +360,8 @@ public:
return m_bDyna;
}
+ bool RayHit(KX_ClientObjectInfo* client, MT_Point3& hit_point, MT_Vector3& hit_normal, void * const data);
+
/**
* @section Physics accessors for this node.
@@ -608,6 +629,7 @@ public:
KX_PYMETHOD(KX_GameObject,GetMesh);
KX_PYMETHOD(KX_GameObject,GetParent);
KX_PYMETHOD(KX_GameObject,GetPhysicsId);
+ KX_PYMETHOD_DOC(KX_GameObject,rayCastTo);
KX_PYMETHOD_DOC(KX_GameObject,getDistanceTo);
private :