How about using square detection, and then using finer detection with alpha?
sprite.get_image_data().get_data("RGBA", 4*width)
and then you check the A value of the target pixel where mouse is

I did the same with cocos and it worked well.

2011/6/28 greenmoss <[email protected]>:
> I looked at the pyglet mouse picking example (http://sites.google.com/
> site/swinesmallpygletexamples/mouse-picking), but I'm not sure it will
> work for my game. Currently I have two kinds of objects to pick, with
> maybe more to follow:
>
> - GL_LINES; any coordinate along the line should be pickable
> - pyglet sprites; ideally, any pixel that is part of the sprite's
> image should be pickable, but easier/less-granular picks would also be
> acceptable
>
> The pyglet example seems to work based on rays to vertices only, so
> would it work to pick the two types of objects above?
>
> Maybe I need to be looking at color-based picking instead? For
> example, this technique:
>
> http://wiki.processing.org/w/Picking_with_a_color_buffer
>
> Is there an example anywhere using color-based picking with pyglet?
> Could it also easily be adapted to pyglet sprites?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "pyglet-users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/pyglet-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en.

Reply via email to