Hi, in my game project, i use a simple UV scrolling script to make the water look, well, watery.
The thing is that the more instances of water planes i add, the faster the uvs scrolls, as all the objects share a mesh.
The script i use is like this:
# Imports
##############################################
from bge import logic
from bge import events
import mathutils
import random
import bge
##############################################
# SetUp Variables
##############################################
scene = logic.getCurrentScene()
cont = logic.getCurrentController()
obj = cont.owner
scroll_speed = obj["scroll_speed"]
scroll_dir = obj["scroll_dir"]
scroll_speed2 = obj["scroll_speed2"]
scroll_dir2 = obj["scroll_dir2"]
##############################################
# Main Code
##############################################
if not 'mesh' in obj:
obj['mesh'] = obj.meshes[0]
else:
obj['array'] = obj['mesh'].getVertexArrayLength(0)
for current_vertex in range(0,obj['array']):
vert = obj['mesh'].getVertex(0,current_vertex)
uv = vert.getUV()
uv[scroll_dir] = uv[scroll_dir]+scroll_speed
vert.setUV(uv)
uv2 = vert.getUV2()
uv2[scroll_dir2] = uv2[scroll_dir2]+scroll_speed2
vert.setUV2(uv2)
So, i’m wondering: Is there a way to assign the object an ingame created copy of the actual mesh, so the uvscroll affects only that object’s mesh?