Another cool spawn tech!
6 posts • Page 1 of 1
Another cool spawn tech!
I've found new interesting way to spawn objects with dynamic properties
I use class object scope operator "->"
in that way all custom properties (like ttl in example) are stored inside box.
example:
I use class object scope operator "->"
in that way all custom properties (like ttl in example) are stored inside box.
example:
- Code: Select all
(scene.addBox {pos := [1,1]; size := [1,1]}) -> {
color = {[1,1,1,sin(sim.time)]};
ttl := sim.time;
density = {sim.time > ttl + 3 ? 0 : 2}
}
Dream of Algodoo as game development engine...
-

Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Another cool spawn tech!
Wow, really helpful. Now I can solve my dynamic tracer mystery. Thank you! 
-

Rideg - Posts: 948
- Joined: Tue Dec 15, 2009 5:17 pm
- Location: Östersund, Sweden
Re: Another cool spawn tech!
Brilliant!! Now I can make realistic tracer-clouds if I understand this properly... what does "ttl := sim.time;" mean?
-

TC42 - Posts: 984
- Joined: Sun Jan 09, 2011 1:53 pm
- Location: $ sudo apt get-install sandwich_
Re: Another cool spawn tech!
ttl is a custom object variable 
and if you don't know, when ever ttl is read, it will give the value that is stored in sim.time (or whatever ttl equals)
and if you don't know, when ever ttl is read, it will give the value that is stored in sim.time (or whatever ttl equals)
When asking for help, READ THE STICKIES!
- electronicboy
- Posts: 1694
- Joined: Mon Aug 31, 2009 6:18 pm
Re: Another cool spawn tech!
TC42 wrote:...what does "ttl := sim.time;" mean?
it's a time marker. Saves the time in ttl-variable when the collision occured.
-

Rideg - Posts: 948
- Joined: Tue Dec 15, 2009 5:17 pm
- Location: Östersund, Sweden
Re: Another cool spawn tech!
or that.... Forgot it had to be in brackets fot the thing i said...
When asking for help, READ THE STICKIES!
- electronicboy
- Posts: 1694
- Joined: Mon Aug 31, 2009 6:18 pm
6 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 5 guests





