Recognize entity type with oncollide?
			4 posts			 • Page 1 of 1		
	
Recognize entity type with oncollide?
I want to make a script that doesn't affect planes.  Using e.other.body doesn't seem to work.  thyme and scripting options have changed a lot since the last time I did anything with them, so I was wondering if there's anything I can do.
Using beta 2.1, BTW.
			Using beta 2.1, BTW.
Made some cool stuff a long time ago
		- 
				

Frank - [Best Tutorial Maker 2010]
 - Posts: 193
 - Joined: Mon Aug 31, 2009 6:37 pm
 - Location: the dark side of the moon
 
Re: Recognize entity type with oncollide?
onCollide = (e) => {""+e.other == "plane" ? {} : { do something }}
.body attribute indicate bunch of geoms (glued or fixed together) ID.
			.body attribute indicate bunch of geoms (glued or fixed together) ID.
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: Recognize entity type with oncollide?
Thanks!  I got it to work with e.other.body, though.  It seemed to just disagree with the location of the code.  It's for part of a gun in which a box with its own oncollide is spawned by the oncollide of a part of the gun.  Having the if structure as the first line of code in the spawned object's oncollide seemed to upset things.  Moving it a couple lines down made it work.  I'll keep that in mind if I decide I want the script to affect other geometries that are glued t the background.
			Made some cool stuff a long time ago
		- 
				

Frank - [Best Tutorial Maker 2010]
 - Posts: 193
 - Joined: Mon Aug 31, 2009 6:37 pm
 - Location: the dark side of the moon
 
Re: Recognize entity type with oncollide?
Frank wrote:Thanks! I got it to work with e.other.body, though. It seemed to just disagree with the location of the code. It's for part of a gun in which a box with its own oncollide is spawned by the oncollide of a part of the gun. Having the if structure as the first line of code in the spawned object's oncollide seemed to upset things. Moving it a couple lines down made it work. I'll keep that in mind if I decide I want the script to affect other geometries that are glued t the background.
Show me the code please, there is no magic, everything should work or be fixed
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
 
			4 posts			 • Page 1 of 1		
	Who is online
Users browsing this forum: No registered users and 3 guests



