Tuesday, November 22, 2011
Thursday, November 17, 2011
Unity Environment WIP
been super busy with school lately, but on my free time I still practice some 3D environment art. This one is going to be my first environment done in Unity. Eventually I hope to have a complete outdoor field environment done. I made the trees using Unity's tree creator tool. I am pretty happy with the results, but I am still learning how to use it. I also added the depth of field camera effect and still tweaking it. Since thanksgiving is coming up i'll probably have more time to work on it.
Things I hope to have accomplished by the end of this project:
- learn more about tree creator
- learn to add sky dome and create own texture for it
- add a waterfall and a river
- maybe some birds flying in the sky
- rocks and boulders
- more foliage
- hopefully learn how to make volumetric clouds
Tuesday, July 12, 2011
Tuesday, July 5, 2011
Unity Project 3: Tools
Name:
I recreated the folder structure to fit my workflow:
Fredson Laguna
Timeframe:
Timeframe:
(Start Date to End Date): 5.28.2011 - 7.02.2011
Project Detail - What did you do, exactly.
Audio
Audio/SoundEffects
Audio/Music
Materials
Material/Textures
Meshes
Fonts
Scenes
Scenes/For Tests
Scripts
Scripts/JavaScript
Scripts/C#
Packages
I noticed that Unity sorts the folders in alphabetical order so I decided to create root folders for some of the assets so that it would be easier for the eyes to navigate.
I decided to create 3 simple tools that I figured may be useful to me in future projects:
Select Objects By Tag (Shift+T)
In the event that the user wanted to select all objects that have the same tag they would just need to select one of the objects that have the desired tag and press Shift+T:
@MenuItem ("Project Tools/Select Objects By Tag #t" )
static function SelectTag()
{
///stores the selected GameObject into var name
var selectedObject : Object = Selection.activeObject;
var tag : String = selectedObject.tag;
//this will stored the game object's tag in var gos
var gos = GameObject.FindGameObjectsWithTag(tag);
//this will select all the game objects that have the tag of the initial selected object
Selection.objects = gos;
}
Hide/Unhide Objects (Shift+H)
The user can quickly enable or disable an object by selecting the object and pressing Shift+H:
@MenuItem ("Project Tools/HideUnhide Selected Objects #h" )
static function HideUnhide()
{
/// This will store the selected GameObjects into an GameObject[] array
/// Selection.gameObjects = selected objects
var selectedObjects : GameObject[] = Selection.gameObjects;
for (var go : GameObject in selectedObjects)
{
// If game object is enabled, disable it
if(go.active == true)
go.active = false;
// If game object is disabled, enable it
else
go.active = true;
AssetDatabase.Refresh();
}
}
Create material from selected texture (Shift+M)
The user can select a diffuse texture and create a material from it:
@MenuItem ("Project Tools/Create Material From Selected Textures #m" )
static function CreateMaterial()
{
// This creates a new material variable that uses the diffuse shader
var newMaterial : Material = new Material (Shader.Find("Diffuse"));
// Generates the new material and saves it in the assets folder upon creation
AssetDatabase.CreateAsset(newMaterial, "Assets/Materials/NewMaterial.mat");
// Creates a Texture2D with the name textures from the selected texture
var textures : Texture2D = Selection.activeObject as Texture2D;
// var textures is the texture assigned to the created material
newMaterial.mainTexture = textures;
AssetDatabase.Refresh();
}
Time Tool
For the time tool I actually created it twice using two different methods. In one I created one big function that uses switch case to access each command. I used Input.inputString as a variable that acted as a switch:
var input = Input.inputString;
function Timetools(input)
{
switch (input)
{
case "1":
do this;
break;
}
}
The second way I approached this project was I created an enumeration that uses switch case to access each time tool function:
enum TimeTools{DoNothing, StartTimeSwitch, FromLoadTimeSwitch, StopTimeSwitch, ContinueTimeSwitch, ResetTimeSwitch, CountDownTimeSwitch, ContinueTimeDownSwitch, AddToTimeOnceSwitch, AddToTimeMultiSwitch, ActualTimeSwitch}
var timeTools : TimeTools;
timeTools = TimeTools.DoNothing;
if(Input.GetKeyDown("1"))
timeTools = TimeTools.StartTimeSwitch;
switch(timeTools)
{
case TimeTools.StartTimeSwitch:
DoThis();
break;
}
Software Used:
Unity3D
Final Thoughts - Reflect for a moment(Postmortem)
This was another enjoyable project. Got to finally understand how tools are created in Unity. I am also pleased that I got to use enumerations and switch case since I've never used the two before until this project. Now I have a better understanding of how they work. At first this project was a bit overwhelming for me since it took a while for me to understand mod% but now I got the hang of it and now I also know how to use Input.inputString.
Break down your Time (Research, Art, Design, Coding, Playtesting)
Research: 15+ hrs.
Art: 1 hrs.
Design : 1-2 hrs.
Coding : 15+ hrs.
Playtesting : 1-2 hrs.
Monday, May 9, 2011
Unity Project 2
Link: Unity Project 2
Name:
Break down your Time (Research, Art, Design, Coding, Playtesting)
Fredson Laguna
Timeframe:
Timeframe:
(Start Date to End Date): 4.22.2011 - 5.01.2011
Project Detail - What did you do, exactly.
For the "On Your Own" requirements I implemented:
Pickup Items: Life, Shield, Single Shot, Double Shot
All of the pickup items share a script that translates their y coordinates down to avoid being stagnant upon creation. I had stored the pickup prefabs as GameObjects in the bullet script so that when an explosion is created from destroying an asteroid a number from 0-30 (using Random.Range) is generated and depending on what number gets generated one of the 4 pickups will be instantiated or none at all (to avoid having a pickup be created every time an asteroid is destroyed).
All of the pickups were given the tag "PowerUp" and a string variable was created so that when the player collides with a pickup (tagged as PowerUp) the variable will equal to that of the name of the pickup touched allowing unity to differentiate between the different pickups even though they all share the same tag.
for example: (Life pickup)
function OnTriggerEnter (other: Collider)
{
if(other.gameObject.tag == "PowerUp")
{
var powerUpContainer = other.gameObject.name;
if (powerUpContainer == "prefab HealthPowerUp(Clone)")
{
lives += 1;
}
}
}
A boolean variable was created that enables and disables the single and double shot. If a double shot pickup has been touched, the boolean for the single shot will become false while the boolean for the double shot becomes true.
I used two cubes that have a rotation script assigned to it that are parented to the player object as bullet slots. The material renderer is set to false by default until a double shot pickup has been obtained.
Random Variables: Speed and Scale of the asteroids
The scale was generated using Random.Range with the max number being a variable (float) that would change as the player advances to the next level
The speed was determined by the size of the asteroid, the bigger the asteroid the slower it will move.
Flashing effect: Player flashes white upon damage
2 Levels: Each with their own BGM
Software Used:
Unity3D
Final Thoughts - Reflect for moment (Postmortem)
Break down your Time (Research, Art, Design, Coding, Playtesting)
Research: 15+ hrs
Art: 3-4 hrs.
Design: 5 hrs.
Coding: 15+ hrs
Playtesting: 2 hr
Tuesday, April 19, 2011
Unity Project 1
Fredson Laguna
(Start Date to End Date): 4.9.2011 - 4.19.2011
Project Detail - What did you do, exactly.
For the "On Your Own" requirements I created two levels along with objective screens in between the levels that displays the number of points required to complete the level. Level 1 consists of everything that was covered in the project 1 tutorials. Level 2 contains elements created on my own.
The enemy cubes spawn at random locations, and travel across the screen at random directions.
To determine what direction the cubes travel, I created a Random.Range variable for the X and Y axis inside of a Start() function and assigning those variables to a transform.Translate thats inside of the Update() function so that every time the cubes spawn they constantly travel every frame at the randomly generated X,Y coordinates. To make sure that the cubes don't continue to travel once they reach the camera boundary, I created a timer so that after a fixed amount of time the cubes will be destroyed and then spawn again somewhere on the screen.
A timer was also created for the enemy spheres so that after a certain amount of time they too would disappear and re-spawn on the screen. The spheres were given a flashing effect and to create it I used Mathf.PingPong inside of the Update() function so that it would constantly change between the randomly generated color to white. Instead of having the spheres fly across the screen I had them move in a circular motion. To create the effect I used transform.Translate and transform.Rotate inside of the Update() function. The speed of the rotation is faster than the translation so that the spheres would constantly spin in a circle. After doing so I decided to create a Random.Range for an Array that contained the two rotational directions that would decide whether the spheres rotate clockwise or counter clockwise.
Finally, I decided to create a black version of the cube and sphere that use the same scripts as the regular cube and sphere, so they behave the same way except they give negative points instead. To do this I created a boolean variable in the inspector, which was set true or checked on for the black shapes. If, else statements were also used in conjunction to differentiate lines of code.
I have learned a lot by following the tutorial and have learned even more by completing the "On Your Own" tasks. I came across a lot of errors along the way, some minor that only took minutes to figure out while others took hours and a lot of experiments. Even though I was left stumped most of the time, my frustrations and research led to new valuable knowledge.
Research: 10+ hrs
Art: 3-4 hrs.
Design: 3 hrs.
Coding: 10+ hrs
Playtesting: 1 hr
Subscribe to:
Posts (Atom)