I’ve just recently gotten into UPBGE, and am using it to mesh-batch a voxel-based terrain. Upon selection of one of the batched cubes, I’d like to be able to split it from the rest of the batch.
Supposedly there’s a split() function that allows for this; but I have yet to find the proper syntax…
I’ve literally read every documentation available online on the subject (There’s not much) , and have found nothing of use.
Here’s my code so far:
import bge import math import random import mathutils from mathutils import noise cont = bge.logic.getCurrentController() obj = bge.logic.getCurrentScene().objects own = cont.owner add = cont.actuators['add'] def roundup(x): return int(math.ceil(x / 1)) * 1 def roundupxy(x): return int(math.ceil(x / 20)) * 20 coords =  for x in range(20): for y in range(20): position = [(own.worldPosition + x) - 25, own.worldPosition + y, 0] H =0.5 lacunarity = 0.1 octaves = 5 Z = mathutils.noise.fractal(position, H, lacunarity, octaves, noise.types.STDPERLIN) print (Z) for z in range(roundup(abs(Z))): add.instantAddObject() addedobj = add.objectLastCreated print ('added') addedobj.worldPosition = (x*2, y*2, (z)*2) coords.append(addedobj) batchGroup = bge.types.KX_BatchGroup(coords)
I have no trouble merging the objects; it’s just the de-merging that’s presenting the problem. In another piece of code (run from a different object), I attempt to remove specific objects from the batch group created:
import bge cont = bge.logic.getCurrentController() own = cont.owner obj = bge.logic.getCurrentScene().objects near = cont.sensors['Collision'] for i in near.hitObjectList: bge.types.KX_BatchGroup.split(i) #This line is what I'm having trouble with
Could someone kindly give me the proper syntax of split() in this context?