I’ve got a problem in BGE with textures. I have to add a circle from a layer to my scene and change the positions of the vertices. This is not a problem. The problem is that the position of the vertices is different everytime I add the circle. So I have to add an texture to the circle after I change the positions of the vertices. When I do it first the texture looks wrong.
In Blender Render I solved this problem but I dont know how to do it in BGE using python. Can anyone tell me how to add the texture with python while runtime?
Now I add this from a layer to my sceen and change the vertices to the positions I have to:
floor= scene.addObject("floor",owner)
mesh = floor.meshes[0]
i = 0
for v in range(0,16):
x2 = floorX[i]
y2 = floorY[i]
z2 = floorZ[i]
vert = mesh.getVertex(0,v)
vert.XYZ = [x2,y2,z2]
i = i + 1
And this is my result:
As you can see the texture is distorted because it was on the circle bevor I changed the positions of the vertices. I have to add the texture after I’m finish with doing that to get a good result but I don’t know how to do that.
Anyway. The problem you get is that you move the position in 3D space, but you keep the location in UV-space untouched. I think you need to move the UV coordinates too.