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>2009-12-04 14:27:40 +0300
committerBenoit Bolsee <benoit.bolsee@online.be>2009-12-04 14:27:40 +0300
commit0b6873a776552bd47c305ee1bc4e629a76da0037 (patch)
treea64b73ec3bba5adfc5e6cf23722fd93fcdec8a4e /source/gameengine/Physics/common
parent1dcca75e047a54630c9c005c994fa3b21d6863cd (diff)
BGE: Add option to return UV coordinates aofthe hit point to KX_GameObject::rayCast(). Details in PyDoc.
Diffstat (limited to 'source/gameengine/Physics/common')
-rw-r--r--source/gameengine/Physics/common/PHY_DynamicTypes.h14
-rw-r--r--source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h8
2 files changed, 20 insertions, 2 deletions
diff --git a/source/gameengine/Physics/common/PHY_DynamicTypes.h b/source/gameengine/Physics/common/PHY_DynamicTypes.h
index 7ce40001af7..08d94a2850a 100644
--- a/source/gameengine/Physics/common/PHY_DynamicTypes.h
+++ b/source/gameengine/Physics/common/PHY_DynamicTypes.h
@@ -22,6 +22,20 @@ subject to the following restrictions:
struct KX_ClientObjectInfo;
class PHY_Shape;
+struct PHY__Vector2
+{
+ float m_vec[2];
+
+ operator const float* () const
+ {
+ return &m_vec[0];
+ }
+ operator float* ()
+ {
+ return &m_vec[0];
+ }
+};
+
struct PHY__Vector3
{
float m_vec[4];
diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
index 291dac298dc..86e72c70bb7 100644
--- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
+++ b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
@@ -52,6 +52,8 @@ struct PHY_RayCastResult
const RAS_MeshObject* m_meshObject; // !=NULL for mesh object (only for Bullet controllers)
int m_polygon; // index of the polygon hit by the ray,
// only if m_meshObject != NULL
+ int m_hitUVOK; // !=0 if UV coordinate in m_hitUV is valid
+ PHY__Vector2 m_hitUV; // UV coordinates of hit point
};
/**
@@ -64,6 +66,7 @@ class PHY_IRayCastFilterCallback
public:
PHY_IPhysicsController* m_ignoreController;
bool m_faceNormal;
+ bool m_faceUV;
virtual ~PHY_IRayCastFilterCallback()
{
@@ -76,9 +79,10 @@ public:
virtual void reportHit(PHY_RayCastResult* result) = 0;
- PHY_IRayCastFilterCallback(PHY_IPhysicsController* ignoreController, bool faceNormal=false)
+ PHY_IRayCastFilterCallback(PHY_IPhysicsController* ignoreController, bool faceNormal=false, bool faceUV=false)
:m_ignoreController(ignoreController),
- m_faceNormal(faceNormal)
+ m_faceNormal(faceNormal),
+ m_faceUV(faceUV)
{
}