NEON appear as a black floating powder

  • 0xHenryMC
    28th June Member 0 Permalink
    This is my graphics code...
     
    elem.property(neon, "Graphics", function (i, r, g, b)
        if sim.partProperty(i, "tmp") ~= nil and sim.partProperty(i, "tmp") == 1 then
            return 0,ren.FIRE_BLEND+ren.NO_DECO,255,255,255,125,255,255,125
        elseif sim.partProperty(i, "tmp") == nil then
            return 0,ren.FIRE_BLEND+ren.NO_DECO,255,r,g,b,r/2,g/2,b/2
        end
    end)
     
    ... Everytime i create neon it will appear as a gray powder, but i expected it to be a gray gas. It only glow and appear as an actual gas when its tmp eq. 1. I couldn't identify the problem (i tried to edit the elseif statement 3 times).
     
    Edited once by 0xHenryMC. Last: 28th June
  • Jerehmia
    28th June Member 0 Permalink

    The way the if statement is written the function doesn't return anything when sim.partProperty(i, "tmp") ~= 1 (so it exists but has a value other than 1). I assume that a NEON particle is initialized with tmp 0 which would mean that the element's Graphics function doesn't return anything util you set the particle's tmp to 1.

     

    If my asumption is correct the code should be:

    elem.property(neon, "Graphics", function (i, r, g, b)
        if sim.partProperty(i, "tmp") == 1 then
            return 0,ren.FIRE_BLEND+ren.NO_DECO,255,255,255,125,255,255,125
        end
        return 0,ren.FIRE_BLEND+ren.NO_DECO,255,r,g,b,r/2,g/2,b/2
    end)
    Edited 9 times by Jerehmia. Last: 28th June