moving vertex along normals by code
if you ever worked with 3d painting digital sculpting stuff, like what you have in maya or even better zbrush (don't mention it's 2.5 because i know) or mudbox, you know that they give you sort of brush that can pull or push vertices along their normals. I am developing a mesh procedurally without a problem, i can use a brush to pull up or down the vertices on the world's up vector, what i can't figure out is how to move those vertices along their normal axis, can anyone help me and guide me toward an article or a code snippet on how to do it? thanks
Grrr am i stupid? wouldn't adding the normal vector3 to the position of the vertex solve the problem? i mean, if i would want to move the vertex exactly one unit from the normal wouldn't it be the position + normal?
I guess that mesh normals are in local space, and position is in world space. Try doing:
position += transform.TransformDirection(normal);
http://docs.unity3d.com/ScriptReference/Transform.TransformDirection.html
Your answer
Follow this Question
Related Questions
Can't move player with this code why?,I cannot move my player with this code why? 0 Answers
Lock player movement only to x when moving on x, and lock movement only to y when moving on y 2 Answers
[Shader] normal vector and model matrix inverse 1 Answer
Help changing input to axis 0 Answers
how do i reference two input axis at one time on javascript 0 Answers