Check object existence
			4 posts			 • Page 1 of 1		
	
Check object existence
I tried to check some object existence by Scene.entityByGeomID(x) 
But if x pointing object were non-existence, console said
Failed to find entity with geom id: #x
I tried this script
    
x is a random number
but a conditional sentence don't work from the beginning
Is there checking object existence method in algodoo script ?
sorry, I borrow google translate power
			
		But if x pointing object were non-existence, console said
Failed to find entity with geom id: #x
I tried this script
- Code: Select all
- Scene.entityByGeomID(x) == undefined ? {} : {}
x is a random number
but a conditional sentence don't work from the beginning
Is there checking object existence method in algodoo script ?
sorry, I borrow google translate power
- 0xB10C1DE
- Posts: 2
- Joined: Wed Feb 26, 2014 4:26 am
Re: Check object existence
I've try something like that, usin xFor() to find all entityes by ID. It works but very long (about 30 sec)
			- Code: Select all
- scene.my.xFor = (n1, n2, code) =>
 {n2 > n1 ? {m := (n1 + n2) / 2; scene.my.xFor(n1, m, code); scene.my.xFor(m + 1, n2, code)} : {code(n1)}};
 scene.my.all = [];
 scene.my.xfor(0,65535,(id)=>{scene.my.all = scene.my.all ++ [(Scene.entityByid(id)).entityID]});
 scene.my.all
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: Check object existence
thank you I'll try it in this weekend i'm in school now
			
		- 0xB10C1DE
- Posts: 2
- Joined: Wed Feb 26, 2014 4:26 am
Re: Check object existence
- Code: Select all
- _entityExists := (eID)=>{
 rtn := false;
 (entityByID(eID)).entityID > 0 ? {
 rtn = true
 } : {
 rtn = false
 };
 rtn
 };
- s_noonan
- Posts: 61
- Joined: Tue Mar 30, 2010 2:25 am
			4 posts			 • Page 1 of 1		
	Who is online
Users browsing this forum: No registered users and 11 guests




