diff options
author | Porteries Tristan <republicthunderbolt9@gmail.com> | 2015-07-24 21:28:39 +0300 |
---|---|---|
committer | Porteries Tristan <republicthunderbolt9@gmail.com> | 2015-07-25 10:43:06 +0300 |
commit | 9939c189001566e1cfdbb09ecffdec177920b31a (patch) | |
tree | 6251a2acf318ace7329b937492a85e90bffcabfb /source/gameengine/Ketsji/KX_ConstraintActuator.cpp | |
parent | e301cf3ec2cb8caa544032238cf7a1e7bb5e2523 (diff) |
BGE: Fix T35288 Touch/Ray/Mouse sensor and Constraint actuator with material check doesn't work.
Now we look at all materials instead of the first. So m_auxilary_info is useless and removed.
Diffstat (limited to 'source/gameengine/Ketsji/KX_ConstraintActuator.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_ConstraintActuator.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp index e5662b54b83..e07660cef72 100644 --- a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp +++ b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp @@ -41,6 +41,7 @@ #include "KX_GameObject.h" #include "KX_RayCast.h" #include "KX_PythonInit.h" // KX_GetActiveScene +#include "RAS_MeshObject.h" #include <stdio.h> @@ -129,15 +130,17 @@ bool KX_ConstraintActuator::RayHit(KX_ClientObjectInfo *client, KX_RayCast *resu } else { - if (m_option & KX_ACT_CONSTRAINT_MATERIAL) - { - if (client->m_auxilary_info) - { - bFound = !strcmp(m_property.Ptr(), ((char*)client->m_auxilary_info)); + if (m_option & KX_ACT_CONSTRAINT_MATERIAL) { + for (unsigned int i = 0; i < m_hitObject->GetMeshCount(); ++i) { + RAS_MeshObject *meshObj = m_hitObject->GetMesh(i); + for (unsigned int j = 0; j < meshObj->NumMaterials(); ++j) { + bFound = strcmp(m_property.ReadPtr(), meshObj->GetMaterialName(j).ReadPtr() + 2) == 0; + if (bFound) + break; + } } } - else - { + else { bFound = m_hitObject->GetProperty(m_property) != NULL; } } |