Hello Unity community, I'm here to ask simple question - how to find and manipulate specific vertex of a 3D object? To make question even simpler - Imagine box with 4 vertices. How do i manipulate one of top ones? All i ask for is where to look at. Not asking how to rotate or move them, just how to find desired vertex and do stuff to it. Thanks in advance
It's not really answering the question, but thanks... i guess. Ofcourse i did go trough all the documentation, but it does not mean i actually understood it. Question still remains simple - how to find specific 1 out of 8 vertexes on a cube so i can manipulate it later. I could tell unity to show me all vertices in an array and do stuff to them, but how do i tell it to take exact vertex i want? Lets say using Print (thatParticularVertexOnTopOfCube); doStuffToIT();
Your question have the answer in it (providing you read closely the page Jessy indicated). The most top vertex on an object should hold also the highest y value.
Probably. You could have one with a non-tiling, static normal map, for a non-skinned cube, and have the texture "bend" the normals back to where they would be, if you had "hard edges". (An object space normal map would be faster than a tangent space one for this mesh, and yield identical results, if it were baked properly.) I haven't learned enough about normal map baking yet to try this, but I bet the 24 verts approach would yield better results far away, do to mipmapping.
Ok, think I know what you mean by highest value. Well, that makes it.. harder, but should work the trick. Was hoping Unity engine is somehow numerating or naming them like most of 3D modeling software. Also i was debugging vertex count on cube, log said it's 24, I got confused and came to forums for help. Now, after a bit of googling, i found out the answer to that. I always thought vertices can be shared trough faces connected to it, apparently not. If cube has 6 faces, each of them consists of 4 vertices. Multiplied together it makes 24. Basically this means that there are 3 vertices in the same point in 3D space all the time, included in calculations of graphics card. What a waste of calculations, making GPU calculate same vertex over and over again multiplied by faces connected to it.. meh anyway thanks for answers, think i'll be fine for now. edit: however, unusual and probably simple question - Batching: If i have 100 cubes out, Batched they are only doing 1 draw call since all are same What if i changed vertex position of one of boxes, making it look .. different. Would that now batch 99 boxes and make 2 draw calls instead, despite being same model and same material?
It's not a waste; you get one normal per vertex, and you need three normals in the same place at every vertex on a hard cube. So, 8 vertices, multiplied by 3: 24. 6 faces x 4 vertices makes sense to a person, but that's not how the GPU sees it, which is what you actually need to worry about, in terms of vert count. You can have a cube with 8 vertices, but unless you have a normal map, the likes of which I was talking about, the lighting on it is going to make it resemble a "very blocky sphere".