Blender Git Commit Log

Git Commits -> Revision 720d452

Revision 720d452 by Porteries Tristan (master)
October 7, 2015, 20:14 (GMT)
BGE : Collision mask support in raycast + and raycast cleanup.

I have removed the m_pHitObject, m_xray and m_testPropName and replace them by a temporary struct "RayCastData" which contains these datas and a collision mask. Finally i add a collision mask argument in the python function "rayCast" :
```
rayCast(to, from, dist, prop, face, xray, poly, mask)
```

It can be useful to hit only object which are on the right colision layer. for example if you have hitbox for a charater or vehicle you don't want to hit it with raycast.

test file : {F237337}
left mouse click on two planes and see console messages.

Somewhat more elaborate test file by @sybren: {F237779}
Look around and click on the cubes. One cube lamp responds, the other doesn't, based on their collision groups.

Reviewers: moguri, hg1, agoose77, campbellbarton, sybren

Reviewed By: agoose77, campbellbarton, sybren

Subscribers: campbellbarton, sergey, blueprintrandom, sybren

Projects: #game_engine, #game_physics

Differential Revision: https://developer.blender.org/D1239

Commit Details:

Full Hash: 720d4521cdd0986d9c6df97924b72eed72e5a3af
Parent Commit: 7a06613
Lines Changed: +120, -76

12 Modified Paths:

/doc/python_api/rst/bge_types/bge.types.KX_GameObject.rst (+3, -1) (Diff)
/source/gameengine/Ketsji/KX_ConstraintActuator.cpp (+4, -4) (Diff)
/source/gameengine/Ketsji/KX_ConstraintActuator.h (+7, -3) (Diff)
/source/gameengine/Ketsji/KX_GameObject.cpp (+49, -39) (Diff)
/source/gameengine/Ketsji/KX_GameObject.h (+13, -5) (Diff)
/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp (+3, -3) (Diff)
/source/gameengine/Ketsji/KX_MouseFocusSensor.h (+6, -2) (Diff)
/source/gameengine/Ketsji/KX_RayCast.h (+18, -9) (Diff)
/source/gameengine/Ketsji/KX_RaySensor.cpp (+3, -3) (Diff)
/source/gameengine/Ketsji/KX_RaySensor.h (+6, -2) (Diff)
/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp (+2, -3) (Diff)
/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h (+6, -2) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021