Unity3D - Detect a vertex on planet mesh without cubes

I have a planet mesh that I am generating procedurally (based on a random seed). The generator creates tectonic plates and moves them creating the land masses, mountains and water depressions you see below; ~2500 points in a planet. The textured surface is just a shader.

Each vertex will have information associated with it, and I need to know which vertex they are pointing at to relay this information.

I am looking for a way identify which vertex they are pointing at. The current solution is to generate a cube at each vertex, then use a collider/Ray to identify it. The two white cubes in the picture above are for testing.

What I want to know is if there is a better way to identify the vertex without generating cubes?

Answers


  1. if you're doing such awesome and advanced work, surely you know about this

http://docs.unity3d.com/ScriptReference/RaycastHit-triangleIndex.html

  1. when working with mesh, it's totally commonplace to need the nearest vertex.

note that very simply, you just find the nearest one, ie look over them all for the nearest.

(it's incredibly fast to do this, you only have a tiny number of verts so there's no way performance will even be measurable.)

{Consider that, of course, you could break the object in to say 8 pieces - but that's just something you have to do anyway in many cases, for example a race track, so it can occlude properly.}


Need Your Help

jquery bootstrap accordion not expanding vertically fully

javascript jquery html css twitter-bootstrap

I'm using this example fiddle for nested bootstrap accordions.Fiddle here

OpenX --- javascript in banners

openx adbannerview adserver

Does OpenX allow to create banners that contain executable javascript code?