Advanced Primitives

A few days ago I needed a way to create a lot of custom primitives in Unity. Unfortunately, Unity primitives are too limited, can’t be customized at all, and importing geometry from an external 3D software can slow down the workflow a lot. So I made myself this little tool. As I’m quite sure I’m not the only one who needs this, it’s now available on the AssetStore.

In a nutshell: it allows you to create parametric 3D primitives in real time straight from the Unity Editor and your own scripts (a small API is provided). Each comes with its own parameters and (optional) collider. They all have their normals, uvs and (optional) tangents set.

Tested with Unity 4 but it should work with previous versions as well (at least 3.5).
[Asset Store link]


Update 1.1 available.

Changelog:
• New primitive: Pyramid
• New primitive: Slope
• The capsule radius is now clamped to half its height.

Cool.

I’m looking for a tool like yours, but I need a hollow cylinder (tube) with adjustable wall width, and a half-pipe (basically the tube with the top cut off). Would you consider adding these?

A tube will eventually make its way into this tool (don’t know when, life is quite busy at the moment). I don’t have any plan about a half-pipe geometry, but I suppose I could add it to the todo list. Can’t promise anything though.

A tube will be Great.

Have a few more questions.

  1. Is there a way where we can add our own shapes ?
  2. Is the source available?
  3. Can i use this at runtime on WebPlayer or Flash?

Hello,

  1. If you can code, then yes you can extend the base Primitive class and write your own mesh building code. But it’s not documented at all, I’ll add it to the todo list.
  2. No, not at the moment, it’s packed into two DLLs (one for the player, one for the editor).
  3. It has been tested on Standalone and WebPlayer. I can’t really say about Flash, but I don’t see any reason why it would fail on iOS/Android/Flash as it only uses the basic Mono Unity libraries.

Can anyone confirm if it works on IOS/Android/Flash ?

If you can do the documentation or open the source so we can add more functionality then you don’t have to keep on maintaining this plugin. This flexibility would be appreciated as it allows us to add the shapes that we need. Will definitely buy right away when we have the means to add more shapes ourselves.

Thanks.

Nice asset, Chman. I bought it and am making use of it in my project. Some requests for the next update:

  • generalize Pyramid into Cone, i.e. let me choose the number of sides so I can create Tetrahedrons on up to smooth cones
  • an option to have normals be perpendicular to faces, so I can have nice hard, faceted edges
  • a ‘height’ for Plane and Disk. Yes, that’s weird for a flat primitive but it would be passed through to the generated box collider so could be offset from surfaces it is resting on

That’s it for now, thanks!

All good ideas, thanks for the feedback ! I’ll add these to the todo list (which keeps growing… I’ll try to find some time in the coming days/weeks to implement most of it).

Hi
Nice work. Can you please update the tool with drag and drop so that the primitives don’t always spawn at 0,0,0?

-edit-
double post (delete me)

With “drag’n’drop” ? I’m not sure what you mean by that, but you can simply select the primitive and move it as any object (move tool or ‘W’ shortcut).
About it spawning at (0,0,0), what alternative would you suggest ?

i mean drag and drop into the editor. if you grab most items from the project window you can drop them into the scene, and they will spawn at the point where you dropped them. With your tool, you click the icon and it places a primitive into the center of the world which is more often than not, very far away from where it should be. This makes for a poor workflow.

Along those lines, an inner radius option for the disk would be nice as well, allowing us to make 2d rings.

Hi there.
Is it possible to use these primitives with hard edges, ie hard normals to get a low poly look.

I couldn’t find it in the asset store, did you removed it or renamed it by any chance?