Self-delition codes needed
			9 posts			 • Page 1 of 1		
	
Self-delition codes needed
Hello people, it happened that I also need your help...
I need codes for self-delition of object, I know one of them
But it is quiet laggy, if you know some other please tell me.
			
		I need codes for self-delition of object, I know one of them
- Code: Select all
 oncollide:=(e)=>{controlleracc=sim.time; density={sim.time-controlleracc>1.5?{0}:{6}}; oncollide=(e)=>{}}
But it is quiet laggy, if you know some other please tell me.
- 
				

Nait - Posts: 224
 - Joined: Fri Oct 30, 2009 1:56 am
 - Location: Eastern Russia, Vladivostok
 
Re: Self-delition codes needed
- Code: Select all
 AirfrictionMult = NaN
- 
				

savask - Posts: 162
 - Joined: Mon Oct 12, 2009 2:53 pm
 - Location: Russia, Siberia
 
Re: Self-delition codes needed
For Phun use airFrictionMult = NaN
For Algodoo use density = 0
			For Algodoo use density = 0
Cave Johnson wrote:Do you know who I am? I'm the man who's gonna burn your house down! With the lemons! I'm gonna get my engineers to invent a combustible lemon that burns your house down!
- 
				

Matten - Posts: 435
 - Joined: Mon Apr 05, 2010 2:03 pm
 - Location: The Netherlands
 
Re: Self-delition codes needed
I don't think there's a way to make it less laggy.
The only way I can think of is that it get's a collideLife.
When it collides 10 times it gets deleted.
			
		The only way I can think of is that it get's a collideLife.
When it collides 10 times it gets deleted.
- Code: Select all
 (e)=>{e.this.refractiveIndex = e.this.refractiveIndex + 1; e.this.refractiveIndex >= 10 ? {e.this.density = 0}:{}}
- 
				

Rideg - Posts: 948
 - Joined: Tue Dec 15, 2009 5:17 pm
 - Location: Östersund, Sweden
 
Re: Self-delition codes needed
I meant way of counting time, not way of code delitiong...
Thank you Rideg, but when gunpowder explodes amount of collisions is not stable, maybe spawning lasers fixed to objects and making "LaserHitLife"...
			
		Thank you Rideg, but when gunpowder explodes amount of collisions is not stable, maybe spawning lasers fixed to objects and making "LaserHitLife"...
- 
				

Nait - Posts: 224
 - Joined: Fri Oct 30, 2009 1:56 am
 - Location: Eastern Russia, Vladivostok
 
Re: Self-delition codes needed
Well I've got a solution IF the circles that should have a lifetime COLLIDES.
I think you're making an explosion so that will make this possible.
This will spawn 5 circles at the same position and when ten seconds have passed they will delete themselves.
Put that in in any any onCollide/onHitByLaser/onLaserHit script box and it will spawn circles with a ten seconds lifetime.
I wrote a longer post but my computer decided to mess with me and somehow it all got deleted. I also made a Example scene´but I don't know how to post scenes with the post.
Hope this helped.
			
		I think you're making an explosion so that will make this possible.
This will spawn 5 circles at the same position and when ten seconds have passed they will delete themselves.
- Code: Select all
 (e)=>{
for(5, (i)=>{
Scene.addCircle({
color := [0.0, 0.0, 0.0, 1.0];
onCollide := (e)=>{
e.this.controllerAcc = e.this.controllerAcc + sim.time;
e.this.density = {sim.time >= controllerAcc ? {0} : {2.0}};
e.this.onCollide = (e)=>{}
};
controllerAcc := 10;
collideSet := 64;
pos := e.pos;
radius := 0.01
})
})
}
Put that in in any any onCollide/onHitByLaser/onLaserHit script box and it will spawn circles with a ten seconds lifetime.
I wrote a longer post but my computer decided to mess with me and somehow it all got deleted. I also made a Example scene´but I don't know how to post scenes with the post.
Hope this helped.
- 
				

Rideg - Posts: 948
 - Joined: Tue Dec 15, 2009 5:17 pm
 - Location: Östersund, Sweden
 
Re: Self-delition codes needed
Oh man, thanks, it isn't very different from my code, but mutch less lagging, even if there are 100 circles spawned! 
 
This helps
 
PS
In scene details, at left under information is textbox "scene tag". Copy code and past it where you need.
Looks like
			
		This helps
PS
In scene details, at left under information is textbox "scene tag". Copy code and past it where you need.
Looks like
- Code: Select all
 [scene]number[/scene]
- 
				

Nait - Posts: 224
 - Joined: Fri Oct 30, 2009 1:56 am
 - Location: Eastern Russia, Vladivostok
 
Re: Self-delition codes needed
Rideg wrote:but I don't know how to post scenes with the post.
Why do you forget this every time, this is the thirth time I see you asking this....
Cave Johnson wrote:Do you know who I am? I'm the man who's gonna burn your house down! With the lemons! I'm gonna get my engineers to invent a combustible lemon that burns your house down!
- 
				

Matten - Posts: 435
 - Joined: Mon Apr 05, 2010 2:03 pm
 - Location: The Netherlands
 
Re: Self-delition codes needed
no making an attachment I've known how to post scenes in a post since I joined the forum. Last time I asked here was a malfuncion with the site 
			
		- 
				

Rideg - Posts: 948
 - Joined: Tue Dec 15, 2009 5:17 pm
 - Location: Östersund, Sweden
 
			9 posts			 • Page 1 of 1		
	Who is online
Users browsing this forum: No registered users and 3 guests




