Blender Git Loki

Git Commits -> Revision becd467

Revision becd467 by Benoit Bolsee (master)
August 27, 2008, 19:34 (GMT)
BGE patch: KX_GameObject::rayCast() improvements to have X-Ray option, return true face normal and hit polygon information.

rayCast(to,from,dist,prop,face,xray,poly):

The face paremeter determines the orientation of the normal:
0 or omitted => hit normal is always oriented towards the ray origin (as if you casted the ray from outside)
1 => hit normal is the real face normal (only for mesh object, otherwise face has no effect)
The ray has X-Ray capability if xray parameter is 1, otherwise the first object hit (other than self object) stops the ray.
The prop and xray parameters interact as follow:
prop off, xray off: return closest hit or no hit if there is no object on the full extend of the ray.
prop off, xray on : idem.
prop on, xray off: return closest hit if it matches prop, no hit otherwise.
prop on, xray on : return closest hit matching prop or no hit if there is no object matching prop on the full extend of the ray.
if poly is 0 or omitted, returns a 3-tuple with object reference, hit point and hit normal or (None,None,None) if no hit.
if poly is 1, returns a 4-tuple with in addition a KX_PolyProxy as 4th element.

The KX_PolyProxy object holds information on the polygon hit by the ray: the index of the vertex forming the poylgon, material, etc.

Attributes (read-only):
matname: The name of polygon material, empty if no material.
material: The material of the polygon
texture: The texture name of the polygon.
matid: The material index of the polygon, use this to retrieve vertex proxy from mesh proxy
v1: vertex index of the first vertex of the polygon, use this to retrieve vertex proxy from mesh proxy
v2: vertex index of the second vertex of the polygon, use this to retrieve vertex proxy from mesh proxy
v3: vertex index of the third vertex of the polygon, use this to retrieve vertex proxy from mesh proxy
v4: vertex index of the fourth vertex of the polygon, 0 if polygon has only 3 vertex
use this to retrieve vertex proxy from mesh proxy
visible: visible state of the polygon: 1=visible, 0=invisible
collide: collide state of the polygon: 1=receives collision, 0=collision free.
Methods:
getMaterialName(): Returns the polygon material name with MA prefix
getMaterial(): Returns the polygon material
getTextureName(): Returns the polygon texture name
getMaterialIndex(): Returns the material bucket index of the polygon.
getNumVertex(): Returns the number of vertex of the polygon.
isVisible(): Returns whether the polygon is visible or not
isCollider(): Returns whether the polygon is receives collision or not
getVertexIndex(vertex): Returns the mesh vertex index of a polygon vertex
getMesh(): Returns a mesh proxy

New methods of KX_MeshProxy have been implemented to retrieve KX_PolyProxy objects:
getNumPolygons(): Returns the number of polygon in the mesh.
getPolygon(index): Gets the specified polygon from the mesh.

More details in PyDoc.

Commit Details:

Full Hash: becd467be8613b1f71278d8a58337186a3f79170
SVN Revision: 16275
Parent Commit: f6bdba8
Lines Changed: +935, -211

3 Added Paths:

/source/gameengine/Ketsji/KX_PolyProxy.cpp (+265, -0) (View)
/source/gameengine/Ketsji/KX_PolyProxy.h (+71, -0) (View)
/source/gameengine/PyDoc/KX_PolyProxy.py (+100, -0) (View)

33 Modified Paths:

/projectfiles_vc7/gameengine/ketsji/KX_ketsji.vcproj (+6, -0) (Diff)
/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp (+4, -6) (Diff)
/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h (+3, -1) (Diff)
/source/gameengine/Expressions/PyObjectPlus.h (+6, -0) (Diff)
/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp (+4, -6) (Diff)
/source/gameengine/GamePlayer/common/GPC_RenderTools.h (+3, -2) (Diff)
/source/gameengine/Ketsji/KX_ConstraintActuator.cpp (+31, -19) (Diff)
/source/gameengine/Ketsji/KX_ConstraintActuator.h (+4, -1) (Diff)
/source/gameengine/Ketsji/KX_GameObject.cpp (+76, -25) (Diff)
/source/gameengine/Ketsji/KX_GameObject.h (+4, -1) (Diff)
/source/gameengine/Ketsji/KX_MeshProxy.cpp (+31, -0) (Diff)
/source/gameengine/Ketsji/KX_MeshProxy.h (+2, -0) (Diff)
/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp (+4, -12) (Diff)
/source/gameengine/Ketsji/KX_MouseFocusSensor.h (+5, -1) (Diff)
/source/gameengine/Ketsji/KX_RayCast.cpp (+46, -39) (Diff)
/source/gameengine/Ketsji/KX_RayCast.h (+42, -18) (Diff)
/source/gameengine/Ketsji/KX_RaySensor.cpp (+25, -16) (Diff)
/source/gameengine/Ketsji/KX_RaySensor.h (+3, -1) (Diff)
/source/gameengine/Physics/BlOde/OdePhysicsEnvironment.cpp (+1, -2) (Diff)
/source/gameengine/Physics/BlOde/OdePhysicsEnvironment.h (+1, -2) (Diff)
/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp (+5, -0) (Diff)
/source/gameengine/Physics/Bullet/CcdPhysicsController.h (+15, -0) (Diff)
/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp (+71, -24) (Diff)
/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h (+1, -2) (Diff)
/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h (+45, -2) (Diff)
/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp (+1, -2) (Diff)
/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h (+1, -2) (Diff)
/source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.cpp (+15, -16) (Diff)
/source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.h (+1, -2) (Diff)
/source/gameengine/PyDoc/KX_GameObject.py (+26, -7) (Diff)
/source/gameengine/PyDoc/KX_MeshProxy.py (+15, -0) (Diff)
/source/gameengine/Rasterizer/RAS_MeshObject.cpp (+1, -1) (Diff)
/source/gameengine/Rasterizer/RAS_MeshObject.h (+1, -1) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021