securix.io

ProPivot Modifier – Mofify Malformed pivots in Unity.

June 11 | 13

Sometimes when I get a mesh from an artist, the pivots of the mesh are just malformed, so I created a small basic utility to organize the pivots of any given mesh.

I just named this small utility ProPivot modifier; this editor utility  lets you modify your pivot points that come from any 3rd party modeling software and re-organize them so you can work with the pivots correctly instead using the old “hack” of adding Empty GameObjects to organize the pivot orientation of your meshes. Pivots can be rotated, moved and centered by average or bounding box.

If you want to get the utility you can get it from: http://u3d.as/content/pencil-square-games/pro-pivot-modifier/4Lk

For better understanding of what this utility does just watch the demo video on how to use it:

If you have more comments or suggestion on this utility, just let me know via comments 😉

 

ProPrimitives – Parametric primitives in Unity3D

May 5 | 13

I’ve been working for the last few months (on and off) on a utility package that I think is missing from the Unity3D engine and its a way to create flexible primitives in the means of being able to create them with more or less subdivisions depending on the needs.

Of course one would say “Just open maya and create a basic primitive with the specific needs and import it back into Unity”, but there are problems in this approach:

1. What happens for the ones like (me) that don’t use modeling software at all? it will take us a good amount of time to create a simple cube or a sphere plus then I will have to start to fight with the exporting issues and what not to get everything correct into Unity.

2. What happens if I need to create primitives on runtime?, the 3rd party 3d modeling option dies here as there is a need to generate the primitives on the go.

For this reason and also because I like the idea of generating by code 3D shapes I created ProPrimitives for Unity which is basically a Unity editor window that lets you create Planes, Spheres, Cubes, Capsules and Cylinders parametrically depending on the needs.

Also I created a simple API that everyone could use for creating their own primitives via scripting either in an other Editor Window or for in-game content.

Here are some screenshots of what the ProPrimitives Package can do for you:

 

Finally here is the Example.cs code that lets you create primitives via code:

//Create a Plane:
// 1st Param:Width of the plane:
// 2nd Param:Height of the plane
// 3rd Param:(opt) Width subdivisions of the plane (Default: 0)
// 4th Param:(opt) Height subdivisions of the plane (Default: 0)
// 5th Param:(opt) Space where the plane is going to be drawn (Default: PrimitiveSpace.XZ)
//
// to create a billboard just set subdivisions to 0 (3rd and 4th param)
GameObject examplePlane = ProPrimitive.CreatePlane(1, 1, 1, 1, PrimitiveSpace.XY);
examplePlane.transform.position = new Vector3(-5, 0, 0);
//
//Create a Cube:
// 1st Param:Width of the cube (along the X axis)
// 2nd Param:Height of the cube (along the Y axis)
// 3rd Param:Depth of the cube (along the Z axis)
// 4th Param:(opt) width subdivisions (Default: 1)
// 5th Param:(opt) height subdivisions (Default: 1)
// 6th Param:(opt) depth subdivisions (Default: 1)
GameObject exampleCube = ProPrimitive.CreateCube(1, 1, 1, 2, 10, 6);
exampleCube.transform.position = new Vector3(-3,0,0);
//
//Create a Cylinder:
// 1st Param:Radius of the cylinder
// 2nd Param:Height of the cylinder
// 3rd Param:(opt) Number of subdivisions the circumference of the cylinder will have (Default: 15)
// 4th Param:(opt) Number of subdivisions the height of the cylinder will have (Default: 0)
// 5th Param:(opt) Space where the cylinder is going to be drawn (Default: PrimitiveSpace.XZ)
GameObject exampleCylinder = ProPrimitive.CreateCylinder(0.8f, 2, 10, 2, PrimitiveSpace.XZ);
exampleCylinder.transform.position = new Vector3(0,0,0);
//
//Create a Sphere:
// 1st Param:Radius of the Sphere
// 2nd Param:(Opt) Subdivisions the sphere will have (Default: 15)
GameObject exampleSphere = ProPrimitive.CreateSphere(0.7f, 25);
exampleSphere.transform.position = new Vector3(2.5f,0,0);
//
//Create a Capsule:
// 1st Param:Radius if the capsule
// 2nd Param:Height of the capsule
// 3rd Param:(opt) Number of subdivisions the circumference of the capsule will have (Default: 15)
// 4th Param:(opt) Number of subdivisions the height of the capsule will have (Default: 0)
// 5th Param:(opt) Space where the capsule is going to be drawn (Default: PrimitiveSpace.XZ)
GameObject exampleCapsule = ProPrimitive.CreateCapsule(0.8f, 2, 10, 2, PrimitiveSpace.XY);
exampleCapsule.transform.position = new Vector3(5, 0, 0);

So if you want to try the package just get it in, its in the asset store!

Also if you just want to check how it looks like just go to: http://www.youtube.com/watch?v=qC5j0OQ25qo to check a small video I created

Unityception!, Load content created in unity from a build made with unity to Unity!

July 5 | 11

Problem we have:

We need a way to create and edit supermarkets as fast as possible with different products (more than 1500 kind of products) for marketing research and the created scenes need to be lightmaped and tweaked so they look as real as possible at the end.

Facts:

1) Unity doesnt offer an “out of the box” solution for placing specific products on shelfs (and it would be weird to have it).

2) A simple unity project with all the products that reside on our asset database  for a single supermarket has is not feasible as load times will take a lot (projects of 10+GB) and we want to keep file sizes as small as possible.

3) After creating all the products and placing them in each shelf we need to lightmap the whole scene  and do some tweaks as our environment needs to be as realistic as possible.

4) our asset library is huge so we need to organize it and load only the needed assets in each project.

Solution

I came with a fairly easy solution and it was that I “Duplicated” our library. one made of asset bundles and the other made of unitypackages. The one that contained asset bundles was going to be used in an editor that we created and the use of this editor was solely for placing the products/shelfs in the world.

Now when we save the file it saves the address of each asset in a VCS system so we can easily with an editor script download all the packaged assets (this is where we use the unitypackages), import them and place them according to the positions/rotations the editor has.

So finally I ended with 3 Unity Projects, 1 DataBase for assetBundles and one VCS that contained the UnityPackages for importing them.

The unity Projects:

-Supermarket Editor: This project is the one that is in charge for creating and loading all the asset bundles contained in the database and placing them accordingly. it also manages all the logic of the shelfs like you cannot put a product in the floor (only in a shelf), etc.

Its also the one in charge of  creating proceduraly the floor and delimiting the supermarket by creating walls for it. In this project goes all the logic for restricting the user for placing products correctly and also goes all the logic for serializing the data that is going to be loaded after in the Unity Editor.

-SuperMarket Library Creator: This project is used for creating both an asset bundle and an Unity package for the library. The asset bundle is used by the SuperMarket editor and the unity package is used by the Supermarket Scene Loader for loading the created scene inside unity.

-SuperMarket Scene Loader: This is a simple editor script that loads the created scene in the Supermarket Editor into the unity editor for further tweaking like lightmapping, occlusion culling,etc.

So the idea of how this works is like this:

Now after all this is done, this is how it works. Checkout a video I made.

Project Cloudwitch

December 29 | 09

Project Cloudwitch is one of the games  I used to work on at C2Estudio and is one of the games I feel most proud of. The game is about an invasion of aliens trying to take over the control of different planets and your mission is to kill them all and survive as much as you can. Sadly the game didn’t have more levels/story because of budget problems.

(more…)