Torque2D: Camera pick (Mouse's pick)
by Vyacheslav Klymenko · in Technical Issues · 01/06/2009 (7:31 am) · 2 replies
Hello everybody! Please, help me in this simple situation...
I'm currently working on hidden-object game. So there is must using such command:
%objectsArr = t2dSceneGraph.pickPoint(%worldPosition);
By this way I know, what images are "under" cursor.
But if an image is ".png", with alpha-channel - how we can find out, that we clicked on "visible" pixel of the image. An example: if 2 pictures have similar positions, but one of them is "grass", another - "stone" - if we click on the area, where this objects - by command pickPoint (or pickRadius - whatever) - we can "get" only object1 or object2, but the "grass" - is not fill out all area...
Thanks beforehand!
I'm currently working on hidden-object game. So there is must using such command:
%objectsArr = t2dSceneGraph.pickPoint(%worldPosition);
By this way I know, what images are "under" cursor.
But if an image is ".png", with alpha-channel - how we can find out, that we clicked on "visible" pixel of the image. An example: if 2 pictures have similar positions, but one of them is "grass", another - "stone" - if we click on the area, where this objects - by command pickPoint (or pickRadius - whatever) - we can "get" only object1 or object2, but the "grass" - is not fill out all area...
Thanks beforehand!
About the author
#2
If to look closer to hidden-objects games, that released at www.bigfishgames.com (for example) - they are all using pixel-check. Even "Stone of the destiny" (written on Blitz3D).
I have made such game some time ago - Elsa's Adventures
(http://www.mininova.org/tor/1957937)
(http://small-games-precracked.blogspot.com/2008/12/elsas-adventure.html)
I wasn't using pixels-checks and it looks not so cool...
If to think about textures in the memory and time-check I think it is not a problem, because we must check not all textures in the memory, just which "pickPoint" returns and hidden-object game-style - it's not that style, when we need so fast-processing. As well there is must be some command such "GetRGB" - if use this command for the point, where we've clicked, I think it will not take so much time to process... or not? :)
01/09/2009 (1:56 am)
Thanks for the post.If to look closer to hidden-objects games, that released at www.bigfishgames.com (for example) - they are all using pixel-check. Even "Stone of the destiny" (written on Blitz3D).
I have made such game some time ago - Elsa's Adventures
(http://www.mininova.org/tor/1957937)
(http://small-games-precracked.blogspot.com/2008/12/elsas-adventure.html)
I wasn't using pixels-checks and it looks not so cool...
If to think about textures in the memory and time-check I think it is not a problem, because we must check not all textures in the memory, just which "pickPoint" returns and hidden-object game-style - it's not that style, when we need so fast-processing. As well there is must be some command such "GetRGB" - if use this command for the point, where we've clicked, I think it will not take so much time to process... or not? :)
Torque Owner Nikos Beck