Skip to content

Instantly share code, notes, and snippets.

@harryhaaren
Created March 24, 2015 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harryhaaren/c356072cbfbddab7d71c to your computer and use it in GitHub Desktop.
Save harryhaaren/c356072cbfbddab7d71c to your computer and use it in GitHub Desktop.
float nervousness = 0.25; // 0-1 range
// loop over every vertex in the mesh
for(int i = 0; i < mesh.getVertices().size(); i++ )
{
float x = 0.5 - ofRandomuf();
float y = 0.5 - ofRandomuf();
float z = 0.5 - ofRandomuf();
// notice the += here. Increment the position with a value betwee -0.5 and 0.5.
// Therefore average position of the vertex will remain constant, but it will "walk"
mesh.getVertices().at(i) += ofVec3f( x*50*nervousness, y*25*nervousness, z*25*nervousness );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment