Page 1 of 1

Easy question: modify a parameter while the game is running.

Posted: Sun Jul 12, 2009 6:51 pm
by panurge
I did not play very much with ZGE lately, due to university. Anyway, i still have some problems: i think i still do not understand the behaviour of some stuff.

I was amazed by the 'noise' stuff you can attach to a mesh (say, a sphere). I played a lot just by changing the parameters and looking the melting stuff moving.
I'd like to make a model composed by a sphere and a noise: my objective is to change some noise parameters when the game is running, obtaining the same "melting" effect i could manipulate in the editor.

So, i create a mesh, a noise, a model (plus a spawnmodel etc...). If i run the game, i see my static sphere: ok. Now i define a variable 't' and put something like:

Code: Select all

pippo.NoiseSpeed.Y=sin(t)*10;
t+=0.1;
in model's update page (pippo is the noise's name). But nothing changes. Maybe i put the expression somewhere wrong, may you help me?
I mean: ZGE sees no errors, but nothing moves.

I think my error is quite obvious, so pardon my noobiness. Anyway, i may upload a editable file if you think you should directly see what i did.
Very thanks in advance.

Posted: Sun Jul 12, 2009 7:24 pm
by VilleK
Hi,

I think what you are looking for is the RefreshContent-component. It will force a mesh or bitmap to regenerate itself from the producers:

http://www.zgameeditor.org/index.php/Co ... eshContent

Insert it in your project tree after the ZExpression where you modify the t-variable and set the "Component"-property to the mesh. That should make your mesh animate in runtime.

Posted: Sun Jul 12, 2009 7:51 pm
by panurge
oh yeah, this totally works!
Thank you very much, VilleK. I hope i'll create something nice out of it.

Have a great day!

Posted: Mon Jul 13, 2009 5:34 am
by kattle87
One more advice:
if you are applying a noise to something much more complicated than a normal sphere (Let's say you are applying noise to some implicit mesh) you would rather want to have the "unbiased mesh" then get a different mesh that only contains "load mesh UnbiasedMesh" and "noise" generator. This way, you can only refresh the latter and the refreshing will take very little. Otherwise, you could find yourself making tons of computations every single frame :D

Let's not speak about university... I will have an oral exam within 3 (yes, THREE) hours! I'm gonna die :(
:P

Posted: Mon Jul 13, 2009 9:47 am
by kattle87
Sorry guys I'm COMPLETELY OFFTOPIC but I'm SO HAPPY :D I passed the exam :D this was one of the worst I had to do, so I'm just like YUPPIEEEEEEE :D :D :D

;) Ok now back to work for the upcoming exams... I have to hurry up if I want to get a degree by september =)