- Home /
Select a face of an object ingame
Hi!
I'm looking for a way to select individual faces/vertices in a mesh, based on my mouse position ingame, and then manipulate their coordinates. The idea in my project, is to increase or decrease the vertex/face distance in a given direction, from the world center.
Here's the code I have so far:
function OnMouseOver(){
if (Input.GetMouseButton(0)) {
// need code to select nearest Vertex of my mouse here.
//GameObject.Find("Sphere").??
}
}
I have done some searching, and similar questions have been asked in here, but they were not replied (and it is a long time ago), therefore I decided to ask again :)
$$anonymous$$ind of like the unity tools for shaping terrain: http://unity3d.com/support/documentation/Components/terrain-Height.html
I want to achieve a similar effect on a sphere object.
Answer by save · Oct 02, 2011 at 09:48 AM
Have a look at the Sculpt Vertices in the procedural examples. From there you'll figure out what to do.
This seems to not work with Unity anymore (I'm making assumptions because the menu on the website says Unity 2). The scripts don't load for me :\ Ins$$anonymous$$d it says that the scripts are missing for the gameobject. $$anonymous$$uch appreciated if you or anyone else has a tip.