If you try and use KX_VertexProxy in 2.79, it works, but this function is depreciated and cannot be used in UPBGE 0.3+. What module can be used instead that replicates the VertexProxy?
UPBGE 0.3+ uses BPY modules now.
import bge, bpy
def main(self):
if bge.logic.keyboard.inputs[bge.events.UPARROWKEY].activated:
o = bpy.data.objects[str(self.owner.scene.objects["Cube"].name)]
print("Vertices Count: " + str(len(o.data.vertices)))
for v in o.data.vertices:
print("Vertex Location: " + str(v.co))
Here’s most of the available mesh attributes & methods.
1 Like
We can also use bmesh if you are interested in raw speed. Geometry nodes also work in game too!
What does bmesh do?
The BMesh moduel allows real-time visualization of meshes. It’s the same module that Blender uses to visualize orange selections + mesh updates in Edit Mode.
Normally, when you manipulate a mesh with BPY, it’ll only update in Object Mode, but not in Edit Mode. That’s because the 3D Viewport needs to be given instructions on how to display the updates - that’s what the BMesh module is for.
I made a demo of using BMesh here: