background preloader

Unity3D

Facebook Twitter

Incorrect height with sampleHeight. Unity 3D: Collisions Basics - Tutorial - Binpress. In this tutorial I'm going to introduce Unity 3D's built-in collision system.

Unity 3D: Collisions Basics - Tutorial - Binpress

We're going to cover adding collider and rigidbody components to your game objects, how to detect and react to collisions between them, and how to access collision data by script and listen to events triggered by the physics engine. Just note that, depending on the type of game you're building, you may want to explore different options, including Quad-tree collisions or Ray-casting. For the purpose of this tutorial we're going to use a 3D project. I'll assume you have basic C# scripting skills as well as familiarity with the Unity editor and know how to do basic operations like creating empty game objects, nesting game objects, setting tags and layers, and adding components.

Note: This tutorial is based on Unity 4. Defining a collider When creating a new game object in the Unity editor, we can add new components either in the top menu or in the Inspector, after selecting the related object. GUI Scripting in Unity3D Game Engine Programming. Unity GUI In this article I will introduce the reader to Graphical User Interface (GUI) scripting in Unity.

GUI Scripting in Unity3D Game Engine Programming

Unity has a very powerful GUI scripting Application Programming Interface (API). It allows you to quickly create simple menus and GUIs using scripts. Unity provides the ability to create GUI interfaces through the use of scripts. At the time of this writing, Unity does not provide a native visual GUI development tool, although you can probably find some tools on the Unity Asset Store that can be used to create GUIs using some form of visual scripting. Start game once 2 players join Photon. You need to add a call for when the other player joins, you have two options that I can think of.

Start game once 2 players join Photon

One is to just add: void OnPhotonPlayerConnected(PhotonPlayer newPlayer){ //Doesn't get called on the local player, just remote players, so you would still need something to handle on the second player if (PhotonNetwork.playerList.Length == 2) { PhotonNetwork.LoadLevel ("StandardTrack"); } else if (PhotonNetwork.playerList.Length == 1) { Debug.Log ("Not Enough PLayers"); popup.SetActive (true); } } That way it gets called when another player joins.

How to create a canvas and text (UI 4.6) object using c# I've been through lots of tutorials about setting and updating text of objects created using the unity GUI.

How to create a canvas and text (UI 4.6) object using c#

However I'd like to create a new canvas's with text, images and other sub-objects just using c#. Unity New Gui Tutorial. You will love getting gooey with Unity’s new GUI!

Unity New Gui Tutorial

There’s no denying that Unity is an awesome game engine. By catering to the needs of the independent developer while also providing features of premium AAA engines, it’s no surprise that Unity is a now mainstay in game development. Unfortunately, every Achilles has his heel and for Unity, that was the old GUI system. The old GUI system was a painful system that required you to write all your GUI code in OnGUI. It was very programmer-centric which goes against the visual centric nature of Unity itself, and not mention slow and inefficient.

AI help - flocking behavior - C# - Artificial Intelligence. You could start off by setting the accelaration like you were setting the velocity in your original boid code.

AI help - flocking behavior - C# - Artificial Intelligence

That's nowhere near physically correct, but it should have the effect of the velocity converging to the direction you want the boid to move to. The only thing you'll need to pay extra attention to is that you'll probably want to shorten the accelaration vector a bit so the boids don't 'overshoot' their target too much. Disclaimer Remember, you asked for the next few paragraphs.

I'm not particularly good at math or physics for that matter, so it's quite possible that this contains errors. Unity 5 Tutorials - Gamer To Game Developer. Unity - Scripting API: How to Lerp like a pro. I see this sort of thing far too often: transform.position = Vector3.Lerp(startPos, endPos, Time.deltaTime); The person posting it is usually convinced that Vector3.Lerp is “broken”, but the real problem is that they’re not using it correctly.

How to Lerp like a pro

Lerp, short for “linear interpolation” does one very simple thing: given two values, x and y, it returns a value that is t percent between them. If you expect the output to change, the arguments you pass in need to reflect that! In the example above, it doesn’t make sense to just pass in Time.deltaTime, because that’s only the time that passed during the most recent frame. We’ll get better results if we let that timer accumulate over multiple frames. Something like this should get the point across: How to create a canvas and text (UI 4.6) object using c# Unity New Gui Tutorial. GUI Scripting in Unity3D Game Engine Programming. C# - Exact time measurement for performance testing. What replaces the Glow Effect in Unity 5!? This is what I ended up doing, there's a little more info here on my website: Step 1: Set up your camera First thing you want to do is: Select you camera Set the Rendering Path to [Deferred] - although this probably doesn't matter Activate HDR - this does matter Step 2: Add the Bloom Component Next you need to add the Bloom component from Image Effects -> Bloom and Glow -> Bloom.

What replaces the Glow Effect in Unity 5!?

Basic or Complex, doesn't matter Set the intensity to something high, I chose 10. What this means is that anything up to white (1.0) will not glow, but anything over 1.0 will. How to create a canvas and text (UI 4.6) object using c# Unity New Gui Tutorial. 2012 - Vertexpainting Tutorial for animated Trees in Unity.

Animation

How to Generate Shockingly Good 2D Lightning Effects in Unity (C#) Zen Garden: Creating a camera using C# in Unity. Shouldn't be brain science right?

Zen Garden: Creating a camera using C# in Unity

...right? Why am I even using Unity, this platform is brain dead. Anyway, here's notes on Unity cameras. Unity Audio/Microphone. Unity Editor. Change GUI Font size and Color? You need to supply a GUIStyle along with your draw call.

Change GUI Font size and Color?

GUI.Label can take a style as a third parameter. private void OnGUI(){ GUIStyle myStyle = new GUIStyle(); myStyle.font = myFont; GUI.Label(new Rect(10,10, 100, 30), "Hello World! ", myStyle);} The Font must be created as a game asset and can be assigned to the script via the property inspector. It can contain a material that will specify color. Unity - Scripting API: Create a GameObject Image Using Render Textures. On occasion when making a video game there is a need to display a texture that contains an image of a 3D game object. For example, to display in a toolbar, or chat message or something similar. These images could be created statically by your artist, but sometimes the image needs to change based on something happening in the game, or there is some other compelling reason where runtime creation is required. Render Textures are a straightforward method for creating an image like this at runtime. I’ll spend the rest of this post describing how I do this sort of thing.

Making a mesh transparent. Hi everyone, I'm trying to make a scenario in which the user touches the screen and unveil a another image. For example, applying a face-cream on the character face. The user needs to drag his finger (or mouse) over the face in order to apply cream on it. One solution I got was to make a "cream" image layer on top of the "base object" (face), and play with its mesh colors (so this mechanic could work with both 2d and 3d, as long as using meshes).

The problem is when i'm trying to "reset" this mesh into transparent when the scene starts. Usually it functions OK, but after I restart unity , it won't always reset. This function is called on scene awake (sometimes works, sometimes not): private void ResetMeshColors(MeshFilter tempMesh) { Color32[] colors = tempMesh.mesh.colors32; for (int i = 0; i < colors.Length; i++) { colors[i] = new Color32(255, 255, 255, 0); } tempMesh.mesh.colors32 = colors; Debug.Log ("Reset the cream to transparent"); } Here is the rest of the code.

How to Generate Shockingly Good 2D Lightning Effects in Unity (C#) Custom Data, a Unity C# Editor Tutorial. In this Unity C# tutorial you will create a simple data structure and write your own property drawer for it. Noobtuts - Unity Show Variables and Classes in Inspector. Foreword Unity has a powerful feature that helps us to modify values in the Inspector without any programming at all. This article covers everything we need to know in order to show our variables and our custom classes in the Unity Inspector. Showing Variables Just a Variable Let's create a little C# script with the name "Test.cs" that has one int variable: using UnityEngine;using System.Collections; Developers — Build The Future. Developers — Build The Future. Unity 3D: Raycasting for gun hits. C# mouse Raycast question. Firstly, as mentioned by aldonaletto, your missing the "out" keyword in the second paramater of Physics.Raycast(): if(Physics.Raycast(ray, out hit)) Also, FYI, you don't need to have the third parameter unless your limiting the length of the Ray.

Secondly, if you want Selection() to work for multiple clicks you need to reset ray within Selection() each time its called. The code above will only work for a single click and will keep printing out the same number regardless of following clicks because ray is never updated with the current mouse position: void selection() { if(Input.GetKeyDown(KeyCode.Mouse0)) { // Set or reset ray here ray = Camera.main.ScreenPointToRay(Input.mousePosition); if(Physics.Raycast(ray, out hit)) { The following is the full script I used with functionality to draw a red line to the selected object in the Scene window for selection clarification: Hope this helps. Creating &quot;backdrops&quot; in Unity. Unity3D Best Practices. These are a set of best practices I’ve found from a number of other sites (some are copied whole), pared down the ones I don’t agree with and added a few of my own.

I really need to go back through these, as some of them are no longer appropriate for Unity3D version 5+. Each team member should have a second copy of the project checked out for testing if you are using version control. After changes, this second copy, the clean copy, should be updated and tested. Unity3D: Third Person Cameras. The camera is one of the most important elements in a 3D game. It acts as the player's eyes, letting them see the game world from different points of view. In Unity3D, a 3D camera works just like a film camera.

Shader

Google. Mesh from Vertices (Polygon from Spline) I am sharing Delaunay Triangulation Calculation maybe it can be helpful for others. Its useful for basic polygons. Currently searching for Constrained Delaunay Triangulations. Codes working well but maybe i can forget some unnecessary rows. Delaunay - Voronoi Diagram library for Unity. Unity 5 Tutorials - Gamer To Game Developer. Unity New Gui Tutorial. Texture implementations of GetPixel, GetPixels, SetPixel and SetPixels, plus helpers. by Elideb · Pull Request #35 · fehaar/FFWD. Zen Garden: Display a textured 2D quad in Unity using code only. A* Pathfinding Project.

SimpleJSON. Description SimpleJSON is an easy to use JSON parser and builder. It uses strong typed classes for the different JSONTypes. Cg Programming/Unity/Rotations. Spaceship gimbal lock. How to Generate Shockingly Good 2D Lightning Effects in Unity (C#) Procedural generated mesh in Unity. AlexStv. Unity Voxel Tutorial Part 1: Generating meshes from code. Unity3D Best Practices. AlexStv. How to Generate Shockingly Good 2D Lightning Effects in Unity (C#) Color specular shader. How to Generate Shockingly Good 2D Lightning Effects in Unity (C#) - Tuts+ Game Development Tutorial. Procedural generated mesh in Unity. Unity Voxel Tutorial Part 1: Generating meshes from code. Unity3d - How can I add a normal to a text mesh so that it lights correctly? 3DText. Author: Eric Haines (Eric5h5) Description When using 3D text, the default shader is the same one used for GUIText, which makes the 3D text always appear on top of objects.

This is frequently not what you want when using 3D text, so this 3DText shader makes it behave properly. A* Pathfinding Project. Graphs, a Unity C# Tutorial.

Native Plugin

Texture implementations of GetPixel, GetPixels, SetPixel and SetPixels, plus helpers. by Elideb · Pull Request #35 · fehaar/FFWD. Unity New Gui Tutorial. OpenCV for Unity and C# Add Unity3D to native iOS App with Unity 5 and Vuforia 4.x. iPhone & Unity3D: Integrating 3rd Party Static Libraries in Unity3D Generated XCode Projects - SCIO Development Blog.

Cloud Service. Unity Vuforia. Xsens 3D motion tracking. Courses - BurgZerg Arcade. Exit Games: Multiplayer Game Backends and Services. 8. Unity Tutorial - Creating A Multiplayer Game with Photon Unity Network (PUN) Unity3D와 LOD, 그리고 SImplygon. Colliders. Environment setup. Download. Unity 3D Car/Vehicle Example "Race Test" - unity3D.

Microsoft Kinect - Microsoft SDK - Unity3D. Unity and Kinect tutorial « Nightmare Kitty.