Skip to content

FAFF cleanup: Sketch

by AngryAnt on March 19th, 2010

As some of you might have read, at Unity we have a thing called FAFF – very much the same as Google and other IT businesses are doing. It generally lets you step out of the bit stream for a day and just, during work hours, go with whatever crazy idea(s) you’ve been throwing around.

Some of these ideas are pushed into the product later and others are just filed under “something to play with when bored” and “now I can stop wondering about that”. Sketch was a micro FAFF project I just remembered I had filed under “this was fun” and then forgot all about. Since then I’ve continued work on other projects and started new ones – in all likelihood I’ll not return to this project.

So I figured I’d push it to github and let you guys take it for a spin. If nothing else, it’s a nice demo of what you can do with Unity editor scripting.

The idea of Sketch is to have simple tools inside the Unity editor to modify meshes in your assets. My goal with the project was never to turn Unity into a mesh authoring environment, but rather to give people an extra tool for rapid prototyping.

So what’s in there now? The simplest I could think of: Triangle selection and movement.

    Workflow:

  1. Go to the GameObject->Create Other menu and click Sketch Cube.
  2. With the cube selected, click a triangle and with the handle that appears, drag it around to modify the mesh.
  3. GOTO 1.

Alternatively, you could drag in your own mesh from the Assets folder (make sure that it generates a mesh collider in its import settings) and attach the Sketch script to it.

    NOTICE: Sketch modifies the imported asset. This means that:

  • If you modify a some of the basic geometry meshes (such as GameObject->Create Other->Cube), the changes will apply to all cubes until editor relaunch.
  • If the geometry you’re modifying is based on an imported 3D asset, reimporting it will mean you loose your changes.

Structure-wise, Sketch consists of two components: A MonoBehaviour (Sketch/Sketch.cs) and a custom inspector (Sketch/Editor/SketchEditor.cs). The purpose of the MonoBehaviour is merely to do some bookkeeping and provide utility functions (it will even destroy itself at runtime) while the custom inspector holds the logic for doing the modifications.

Sketch

Woah. That’s a lot of talk. Here’s the repository – go nuts: http://github.com/AngryAnt/Sketch

From → Tips and tricks

2 Comments
  1. That’s neat! About 2 months ago I started a similar mini-project, although I started from dragging vertices rather than triangles. If you’re not going to work on this I might just pick it up from where you left off :) Good stuff as always AngryAnt!

  2. hi
    great as always
    i want to know more about meshes and triangles. where can i learn?
    i want to know how should i put vertexes in triangle lists. is the sequence important and how much important it is. someone told me i should list them counterclockwise but how can i calculate that. is always using triangle strips possible.
    let’s think i have 3 vertexes i think dipending of their sequence in triangles list i can create different meshes. (pyramid/triangle or semi pyramid)
    can you help me?
    thank you

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS

*

Spam protection by WP Captcha-Free