Jump to content

Using colliders for picking


bnolan
 Share

Recommended Posts

For cryptovoxels I wrote a non-greedy mesher that creates a really nice lighting effect, but because it has so many faces, it's very slow to use as a collider. eg:

https://www.cryptovoxels.com/play?coords=SE@4E,18N&mode=realism

It's ok on chrome on my macbook, but on slower devices, there is a lot of time spent in javascript (I assume doing the collider or picking). I understand I can set a collider for a mesh - so I can create a greedy mesh (generate one mesh of faces to use as the collider). Can I then set that collider to be pickable so that moving the mouse cursor around (we raycast every frame so we can highlight interesting things to click on) only picks from the collider?

I'm thinking the most efficient way to do this is to merge the voxels into a set of axis aligned cubes (using some kind of greedy algorithm) and use that as the collider / physics model, then greedy mesh the voxels into a non-visible but pickable mesh - is this the best solution or am I overthinking it?

Link to comment
Share on other sites

So the picking is a pretty easy question: You can use any kind of impostors as long as you set isPickable = true on them

For a world as big as yours I would recommend using simple impostors so I do not think you are over-engineering it :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...