Graphic raycast on batch group item

Hi guys,

We are making a game with a lot of simple meshes in the world. It’s a mobile game and we need to keep the build size low as possible. The game doesn’t need physics, because of this(and the build size) we decide to don’t use physics library. Instead of this we’re using graphic raycast with picker to select world items. This work fine until the items are classified on batch groups. Then of this the raycast pick Root as result.
It’s this correct? It’s any way to prevent this? We can’t afford physics libraries size(ammo is almost 3MB). Is there an alternative?

Thanks for your time!

Hi @Javier_Heras,

Yes, that’s correct for the picker to return Root. When static batching several models, a combined mesh instance is created. So the picker doesn’t have any information to select the original entities.

If you are set on not using instances, another way is to setup bounding boxes your self, around the selectable entities. Here is an example on how to do picking with that:

It’s also more performant when compared to the pc.Picker class that uses the framebuffer (it can be slow on mobile).


Oh thank you very much. We will definitely use that method!
Thanks again!!!

1 Like

On side note, it shouldn’t be 3MB. Ammo downloaded is only 300KB total:


Excuse me, my fault, I have interpreted the weight of the build. Thats correct only 300KB are downloaded, thanks for the clarification.