Hi, I’m trying to setup a small universe with planets, stars, etc. in the game engine.
I have used a particle system to generate a universe with all the base objects (LOD0) for the planets, stars etc. Each object is used a lot of times.
Now comes the tricky part. How will I be able to assign all the LOD’s for the objects? I’ve got 4 or 5 LOD’s for each object, I have named them LOD1, LOD2, LOD3, etc. But you can only assign LOD’s to one object at a time…
LOD is not an option when you try to make links (CTRL+L). Is there any other way to assign the LOD’s to all instances of the same object?
I’m sorry if this question is already answered, but ‘LOD’ seems to be hard for the forum search engine to find.
downloaded right now blender 2.74
yes at moment the unique reference is the name of the object created from the tool LOD
that add a suffix on the object name (not mesh name)
so a mesh object named “Batman”
LOD
+generate
create 2 new mesh named:
Batmanlod1
Batmanlod2
note that to work in bge the modifier decimator must be removed(apply)
on the object created
using the default setup (that generate 2 meshes)
and adding one property “lod” = 0 on the highpoly obj.
is not too hard found the meshes to change, using the suffix in the name.
anyway in future should be “automatized”, never good manage these kind of dependences with python
import bge
LODDISTANCE = [-1.0, 7.0, 50.0]
scene = bge.logic.getCurrentScene()
gdtc = scene.active_camera.getDistanceTo
for obj in scene.objects:
if "lod" in obj:
if not "_lod_broken" in obj:
if not "lods" in obj:
try:
lods = {}
lods[0] = obj.meshes[0].name
lods[1] = obj.scene.objectsInactive[obj.name + "lod1"].meshes[0].name
lods[2] = obj.scene.objectsInactive[obj.name + "lod2"].meshes[0].name
obj["lods"] = lods
except:
obj["_lod_broken"] = True
raise
#continue
dist = gdtc(obj)
lod = 2 if dist > LODDISTANCE[2] else 1 if dist > LODDISTANCE[1] else 0
if obj["lod"] != lod:
try:
obj.replaceMesh(obj["lods"][lod],1,0)
obj["lod"] = lod
except:
obj["_lod_broken"] = True
raise