Picking support?

Avatar
  • updated
  • Answered

Is there any support for picking shape objects, i.e. detecting (mouse) rays hitting the shapes?

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Pinned replies
Avatar
Freya Holmér creator
  • Answer
  • Answered

I'm afraid not - similar to colliders, this is currently out of scope, as it has loads of implications and extra overhead for all features ahead to also have a corresponding CPU version of all the GPU code right now, which I don't think I'll prioritize over other features at the moment. for now I'll keep Shapes as a rendering only library!

Avatar
Freya Holmér creator

yep, I'd recommend doing exactly that, using colliders, or doing the math on your own raycasting against the shapes.

it's easier currently to do it for the specific use cases, but for me to add support for it, has *massive* implications unfortunately, so if all you want is to be able to pick a disc/ring, the math for that is pretty trivial, while for me to implement it, means I need to support screen space sizing, arcs, arcs with rounded caps, *dashed arcs* which means it shouldn't pick between dashes, all the different dash styles, screen-space radius discs, and the list goes on

it kinda explodes into forcing me to rewrite all rendering on the CPU for this one seemingly simple thing you know :)

Avatar
imi0

that might be fine... we don't need to be able to pick _everything_. Also, worst case we need to replicate colliders on CPU, which we do with our current solution now anyway ^^

I believe you got yourself a new customer. :)

Avatar
Freya Holmér creator

that's possible, but instead has all sorts of other implications, such as using stencil buffer bits that might already be in use, or alpha channels in buffers that are already in use, across all sorts of render pipelines

it gets complicated very quickly unfortunately!

but yes, full source is included!

Avatar
imi0

what about GPU readback? Picking doesn't always have to be synchronous or fast ^^

But as I got it, the full source is included, so is we would want to go crazy, we could, right?

Avatar
Freya Holmér creator
  • Answer
  • Answered

I'm afraid not - similar to colliders, this is currently out of scope, as it has loads of implications and extra overhead for all features ahead to also have a corresponding CPU version of all the GPU code right now, which I don't think I'll prioritize over other features at the moment. for now I'll keep Shapes as a rendering only library!