Selective visible and invisible possible?

Suppose I have a mesh plane, and I subdivide it into a 10 x 10 grid of 100 faces. Can I make only certain faces invisible in the BGE? I know it will probably require python, if it can be done at all. I want to make numbers appear on different colored backgrounds on different planes behind each other. So being able to turn part of each plane on or off is what I’d like to do.

sounds a bit like overhead.

I suggest to use AddObject to add the background objects with the according colors.

Monster, I know I could do that, but I would have to have 100 different objects! So I was hoping to do it with one object (mesh plane - subdivided into 100 faces). So are you saying it’s not possible to change only one face at a time?

I think you would have to use a texture with transparency enabled. When you want to make a face invisible, move its UVs to a completely transparent part of the texture. You can move them back to make it visible again.

Is that possible in BGE python?

What is the problem with 100 objects?

Well I suppose I could do 100 objects, but it would be tedious to have to set up logic bricks for all those. Actually there would be 300+ objects, because there would have to be 100 text objects, 100 color objects, and 100 objects to ‘cover’ the the text objects as they are used up.

You can use a python script to add them all using add object.
All objects will have the same logic bricks and properties. So you only really need 1 text object, 1 colour object and 1 cover object. Then you can just control them with python.

Which is what I think Monster meant.

not should be too hard if it was a little easier to take these vertices (complicated!!!)


import bge

cont = bge.logic.getCurrentController()

own = cont.owner

sens = cont.sensors
click = sens["Mouse"]
moa = sens["moa"]
if click.status == 1 :
    #for i in dir(own):        print(i)
    x, y = bge.logic.mouse.position
    vec = own.getScreenVect(x,y) * -1
    
    p1 = own.worldPosition
    p2 = p1 + vec
    #         rayCast(objto, objfrom, dist, prop, face, xray, poly)
    ray = own.rayCast(p2,    p1,      100,  "",   1,    1,    5)
    
    
    poly = ray[3] # that is!!!!!!!!!but not chach the vertex again!!! :x
    

almost :smiley:

done :slight_smile:

/uploads/default/original/3X/c/0/c0ee5ee35add69679ff96112e92e940034eb8d35.blendd=1346734007


import bge

cont = bge.logic.getCurrentController()

own = cont.owner

sens = cont.sensors
MLB = sens["mlb"]
MRB = sens["mrb"]
if MLB.status == 1 or MRB.status == 1 :
    
    x, y = bge.logic.mouse.position
    vec = own.getScreenVect(x,y) * -1
    
    p1 = own.worldPosition
    p2 = p1 + vec
    #         rayCast(objto, objfrom, dist, prop,   face, xray, poly)
    ray = own.rayCast(p2,    p1,      100,  "menu", 1,    1,    5)
    
    
    poly = ray[3] # that is!!!!!!!!!
    
    
    if ray[0] != None :
        
    
        mesh = ray[0].meshes[0]
        
        
        polyId = poly
        L=[]
        for i in range( polyId.getNumVertex() ):
            vN = polyId.getVertexIndex( i )
            v = mesh.getVertex( 0, vN )
            L.append(v)
        
        if MRB.positive : uv = 0.1, 0.1
        if MLB.positive : uv = 0.9, 0.9
        
        for v in L:
            v.v, v.u = uv

Exactly, that is what I meant.