Obi Official Forum
Disk Radius Script Not Working - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Fluid (https://obi.virtualmethodstudio.com/forum/forum-3.html)
+--- Thread: Disk Radius Script Not Working (/thread-2335.html)



Disk Radius Script Not Working - goldenmommy - 24-06-2020

Hello,

I'm trying to modulate the disk radius every frame.  Should be very simple:

public Obi.ObiEmitter haloEmitter;
    public Obi.ObiEmitterShapeDisk disk;
    void Start()
    {
        disk.radius = .1f;
    }

    void Update()
    {
        disk.radius += .06f;
    }



And, indeed, in the inspector the radius increases over time, but the result is not rendered -- it stays at whatever radius is set in the inspector before I enter game mode. In fact, whenever I set the radius in script, the result is not rendered, even if I simply assign it a value in Start().  Any suggestions?


RE: Disk Radius Script Not Working - josemendez - 24-06-2020

After setting any property of a emitter shape, you need to recalculate the emission point distribution. This is a relatively expensive operation, and so must be called explicitly. Try:
Code:
disk.GenerateDistribution();
after setting its radius.


RE: Disk Radius Script Not Working - goldenmommy - 24-06-2020

(24-06-2020, 12:05 PM)josemendez Wrote: After setting any property of a emitter shape, you need to recalculate the emission point distribution. This is a relatively expensive operation, and so must be called explicitly. Try:
Code:
disk.GenerateDistribution();
after setting its radius.

thank you so much, it works! in terms of expense, should i keep this out of the update function entirely and only called periodically? or is it just expensive relative to the other parameters and so it won't destroy performance in the update?