Page 1 of 1

getActor question

PostPosted: Mon Jan 04, 2010 10:10 pm
by Leif
Script Editor Syntax:
Actor *MyActor;
MyActor=getactor(x,y);

Question: what if there are several actors at (x,y) ?? I mean - background_1, background_2,player and something else (for example). How can i get exactly needed actor (player) ?

Re: getActor question

PostPosted: Mon Jan 04, 2010 11:26 pm
by skydereign
getactor will take the actor with the highest zdepth. Really what it is doing is taking the visible actor at pixel position, (x,y).

Re: getActor question

PostPosted: Tue Jan 05, 2010 6:52 am
by Leif
And if the actor with the highest zdepth is filled region (transparent) we get visible actor behind it ,right?

Re: getActor question

PostPosted: Tue Jan 05, 2010 8:21 am
by skydereign
I don't think so. The getactor will pick up the filled region, unless you meant if the filled region's transp is set to 1, then yes it will get the actor behind it. Just so you know, any actor is transparent if its transp is higher than 0.996078. Something to note is that the getactor is completely dependent on the transp value, as if you have an actor that has its visibility state turned off, but still allows events, than it will still get that actor. The only two ways to get the actor below the one you want is to either disable its visibility state or to raise its zdepth higher than 0.996078. Wireframe regions only count if the frame itself lies on the xy coordinate, and canvas acts just like a filled region.