Check collision for each vertex?

Is there a way to check if a particular vertex is colliding? We can do that for whole object using collision or near sensor but how do i do that on vertex level? My method is using dupliverts but is there some other light method through some inbuilt python func. Or something like that?

No, you can’t do that on a per-vertex level by default. You could do it yourself, though - if you stick to using rayCast functions from only the vertices’ positions outward, it will tell you which vertices collide, as well as be a CPU-friendly method enough to use in-game.

umm… ok gotta find about that. can you please elaborate a lil bit? how make it point normally to vertex and maybe few lines of example code. a single vertex example would do :smiley:

Well, once you get your vertex position, you would use the rayCast function to see if it hits anything. I’m not exactly sure, but:



mesh = obj.meshes[0]

for v in mesh.getVertexArrayLength(0):
      vert = mesh.getVertex(0, v)
      ray = obj.rayCast(obj.worldPosition + vert.getXYZ() + normal, obj.worldPosition + vert.getXYZ(), 5, etc.)

Note that everything above was code until I got to the rayCast function and saw that I needed the surface normal. That might be contained in the vertex - if it isn’t, then you will have to throw a rayCast in from the vertices’ position to the object’s center to get the normal, then add the normal vector to the final rayCast to get the ray outwards from the vertex.

thanxx will try that