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:
authorDalai Felinto <dfelinto@gmail.com>2014-01-24 08:10:04 +0400
committerDalai Felinto <dfelinto@gmail.com>2014-01-24 08:10:45 +0400
commit67f1fd25ee6361df5f84e254eea103fe7952125f (patch)
treef4ce1a7de5059810b192ffe3b506ff9f95c53917 /source/gameengine/Ketsji/KX_RaySensor.cpp
parent52f2c8aec5e29ed81fd81ebfd8f9965c470a765a (diff)
game engine: implement hitMaterial for collision and ray sensors
Reviewed By: moguri, kupoman Differential Revision: https://developer.blender.org/D167
Diffstat (limited to 'source/gameengine/Ketsji/KX_RaySensor.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_RaySensor.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/gameengine/Ketsji/KX_RaySensor.cpp b/source/gameengine/Ketsji/KX_RaySensor.cpp
index afd39557130..84e615b61ab 100644
--- a/source/gameengine/Ketsji/KX_RaySensor.cpp
+++ b/source/gameengine/Ketsji/KX_RaySensor.cpp
@@ -64,9 +64,8 @@ KX_RaySensor::KX_RaySensor(class SCA_EventManager* eventmgr,
m_bXRay(bXRay),
m_distance(distance),
m_scene(ketsjiScene),
- m_axis(axis)
-
-
+ m_axis(axis),
+ m_hitMaterial("")
{
Init();
}
@@ -144,6 +143,7 @@ bool KX_RaySensor::RayHit(KX_ClientObjectInfo *client, KX_RayCast *result, void
m_hitNormal[1] = result->m_hitNormal[1];
m_hitNormal[2] = result->m_hitNormal[2];
+ m_hitMaterial = (client->m_auxilary_info ? (char*)client->m_auxilary_info : "");
}
// no multi-hit search yet
return true;
@@ -356,6 +356,7 @@ PyAttributeDef KX_RaySensor::Attributes[] = {
KX_PYATTRIBUTE_FLOAT_ARRAY_RO("hitPosition", KX_RaySensor, m_hitPosition, 3),
KX_PYATTRIBUTE_FLOAT_ARRAY_RO("rayDirection", KX_RaySensor, m_rayDirection, 3),
KX_PYATTRIBUTE_FLOAT_ARRAY_RO("hitNormal", KX_RaySensor, m_hitNormal, 3),
+ KX_PYATTRIBUTE_STRING_RO("hitMaterial", KX_RaySensor, m_hitMaterial),
KX_PYATTRIBUTE_RO_FUNCTION("hitObject", KX_RaySensor, pyattr_get_hitobject),
{ NULL } //Sentinel
};