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

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
panurge
Posts: 22
Joined: Sat Jul 04, 2009 11:08 pm

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

Post 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.
User avatar
VilleK
Site Admin
Posts: 2382
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post 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.
User avatar
panurge
Posts: 22
Joined: Sat Jul 04, 2009 11:08 pm

Post 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!
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post 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
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post 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 =)
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
Post Reply