Detect a geom in pos

About advanced scenes, and the Thyme scripting language used in Algodoo.

Detect a geom in pos

Postby Kilinich » Wed Dec 10, 2014 11:06 am

I've found easy way to detect is there geom in pos:

Code: Select all
scene.my.geomIdByPos = (gpos) => {
  probe := scene.addPen({pos:=gpos});
  id := (readable(probe)).geom;
  scene.removeentity(probe); id
}


It returns geomID or 0 if none.
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Detect a geom in pos

Postby Kilinich » Wed Dec 10, 2014 11:20 am

Used a lot in GoL scene:
Rating: rated 6.8
Filesize: 22.77 kB
Comments: 4
Ratings: 5
download
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 6 guests