UFCEK-20-3Web Games Programming Unity 3D: Review of Topics Publishing for the Web.

Slides:



Advertisements
Similar presentations
Working with Tables for Page Design – Lesson 41 Working with Tables for Page Design Lesson 4.
Advertisements

The Librarian Web Page Carol Wolf CS396X. Create new controller  To create a new controller that can manage more than just books, type ruby script/generate.
UFCFSU-30-13D Technologies for the Web Creating and Updating a Graphical Heads-Up Display (HUD)
The Web Warrior Guide to Web Design Technologies
INNER WORKINGS OF UNITY 3D. WHAT WE ARE GOING TO COVER Intro to Unity Physics & Game Objects Cameras & Lighting Textures & Materials Quaternions and Rotation.
UFCFSU-30-13D Technologies for the Web Creating and Using GUI Components.
GameCamp! and Game Davis Creating a 2D Platformer in Unity.
Create slices and hotspots Create links in Web pages Create rollovers from slices Create basic animation Add tweening symbol instances to create animation.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Introduction To Form Builder
HELLO WORLD: YOUR FIRST PROGRAM CHAPTER Topics  Hello World?  Creating a Unity Project –The Unity Project Folder  MonoDevelop: Unity's Code Editor.
FIRST COURSE Creating Web Pages with Microsoft Office 2007.
Tutorial 3: Adding and Formatting Text. 2 Objectives Session 3.1 Type text into a page Copy text from a document and paste it into a page Check for spelling.
UFCEKU-20-3Web Games Programming Unity 3D Physics Colliders and Object Collisions.
Using Dreamweaver. Slide 1 Dreamweaver has 2 screens that do different things The Document window where you create your WebPages The Site window where.
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 4 1 Microsoft Office FrontPage 2003 Tutorial 4 – Using Shared Borders and Themes.
Advanced Level Course. Site Extras Site Extras consist of four categories: Stationeries Site Trash Designs Components.
UFCEKU-20-3Web Games Programming Unity 3D Basic Concepts Using and Creating Prefabs.
EEC-693/793 Applied Computer Vision with Depth Cameras Lecture 13 Wenbing Zhao
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
Domain 3 Understanding the Adobe Dreamweaver CS5 Interface.
SE 350 – Programming Games Lecture 7: Programming with Unity Lecturer: Gazihan Alankuş Please look at the last slide for assignments (marked with TODO)
© 2010 Delmar, Cengage Learning Chapter 8 Collecting Data with Forms.
Web Games Programming An Introduction to Unity 3D.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
Web Games Programming Unity Scripting Fundamentals.
UFCFS D Technologies for the Web Unity 3D: Review of Topics and Related Concepts.
Chapter 5 Quick Links Slide 2 Performance Objectives Understanding Framesets and Frames Creating Framesets and Frames Selecting Framesets and Frames Using.
Learning Unity. Getting Unity
SE 320 – Introduction to Game Development Lecture 3: Unity’s Interface and Concepts Lecturer: Gazihan Alankuş Please look at the last two slides for assignments.
UFCFS D Technologies for the Web Unity Interface Features.
SE 320 – Introduction to Game Development Lecture 7: Programming Lecturer: Gazihan Alankuş Please look at the last two slides for assignments (marked with.
Yingcai Xiao Game Development with Unity3D. Outline IDE Engine Assets Tutorial Examples Inside.
Yingcai Xiao Game Development Intro to Unreal Engine.
Creating a Dynamic Web Page Template Module 5: Beyond the Basics with Expression Web LESSON 10.
Unity GUI Creating and Using GUI Components. Agenda GUI Components GUI Layout Using Styles and Skins for Design ‘Look and Feel’ Scripting GUI Communication.
Problem Solving Methodology Rachel Gauci. Problem Solving Methodology Development Design Analysis Evaluation Solution requirements and constraints. Scope.
Derived from Kirill Muzykov’s Rocket Mouse Tutorial WakeUpAndCode.com.
Creating a Java Application and Applet
GameDevClub CODE CHEAT SHEET NOTE: ALL OF THE CODE IS CASE-SENSITIVE AND THE SYNTAX IS STRICT SO A LOT OF YOUR ERRORS WILL PROBABLY COME FROM TYPOS If.
UFCEKU-20-3Web Games Programming Instantiating World Objects.
UFCFSU-30-13D Technologies for the Web An Introduction to Unity 3D.
Expressive Intelligence Studio // Center for Games and Playable Media // Unity Pro John Murray Expressive.
INTRO TO UNITY Building your first 3D game. DISCLAIMER  “This website is not affiliated with, maintained, endorsed or sponsored by Unity Technologies.
Yingcai Xiao Game Development with Unity3D Inside/Outside Unity3D.
Angry Teapots– using the physics engine in Unity Peter Passmore.
XP Creating Web Pages with Microsoft Office
UFCEKU-20-3Web Games Programming Creating and Updating a Graphical Heads-Up Display (HUD)
Game Development with Unity3D
Welcome! Day1, Lesson 1.
EEC-693/793 Applied Computer Vision with Depth Cameras
Quick Intro to Unity Lecture 2.
Game Development with Unity3D Inside/Outside Unity3D
3D Technologies for the Web
3GB3 Game Design Unity 3D Basics.
More (C#) Scripting Day 2, Lesson 1.
EEC-693/793 Applied Computer Vision with Depth Cameras
Web Games Programming Creating Split-View Cameras and Camera Overlays.
ICT & Statistics Center
EEC-693/793 Applied Computer Vision with Depth Cameras
Chapter 2 Adding Web Pages, Links, and Images
lecture 8 Our First Project
Simple Windows Applications
Tutorial 6 Creating Dynamic Pages
A Prime Example of HCI Application
Using Templates and Library Items
EEC-693/793 Applied Computer Vision with Depth Cameras
Unity Game Development
Presentation transcript:

UFCEK-20-3Web Games Programming Unity 3D: Review of Topics Publishing for the Web

UFCEKU-20-3Web Games Programming Review Topics Scripting Physics and Collision Detection Prefabs Spawning Objects Camera Overlays Heads-Up Displays Publishing

UFCEKU-20-3Web Games Programming Scripting

UFCEKU-20-3Web Games Programming Changing an Object’s Properties via Scripts Cube Object // fragment function Update () { if(Input.GetKeyDown(KeyCode.R)){ gameObject.renderer.material.color = Color.red; } ColourSwitcher.js

UFCEKU-20-3Web Games Programming Inter-Script Communication TransmitReceive Transmit.js Code to send message to Receive.js attached to cube object Receive.js Code to handle message sent by Transmit.js attached to sphere object Sphere Cube

UFCEKU-20-3Web Games Programming Static Variables Declaring variables as static make them available to be referenced by other scripts in the 3D environment. In programming parlance static variables have global scope // static variable declaration in Receive.js static var messageReceived:boolean;

UFCEKU-20-3Web Games Programming Debug Utility Function Very useful debug and environment events utility function Debug.Log (“Message you to want to send to the Console Window”); Debug.Log("I have received " + numberOfMessages + ” messages from the transmit script");

UFCEKU-20-3Web Games Programming Physics and Collision Detection

UFCEKU-20-3Web Games Programming Example Colliders: Models Box on MeshCapsule on MeshMesh on Mesh

UFCEKU-20-3Web Games Programming Using Colliders as ‘Colliders’ The default setting for any collider attached to an object is to restrict the object being passed through be other world objects. The collision event must be handled by a script attached to one or both of the objects involved in the collision ObjectCollisons.js Code to handle collisions

UFCEKU-20-3Web Games Programming Handling Events Initiated by Collisions This function is attached to the First Person Controller (Capsule Collider) function OnControllerColliderHit(hit:ControllerColliderHit){ if (hit.collider == GameObject.Find("RedSphere").collider){ Debug.Log("I've hit the Red Sphere"); }; if (hit.collider == GameObject.Find("BlueSphere").collider){ Debug.Log("I've hit the Blue Sphere"); }; Unity has a built in function for detecting collisions:

UFCEKU-20-3Web Games Programming Using Colliders as ‘Triggers’ Object collisions may be used to generate events ‘triggers’ which can be used to update logic in the World, generate actions, instantiate (create) new objects or remove unwanted objects from the world. Using triggers is one way for the player to collect items that update values via attached scripts. ObjectTriggers.js Code to handle collisions as event triggers. Objects defined as triggers can be ‘passed through’ by other objects

UFCEKU-20-3Web Games Programming Tag Names and the Tag Manager To reference objects in the collision function each object must have a name (Tag) defined via the Tag Manager The tag name used in any script reference must exactly match the tag name defined in the Tag Manager So RedSphere is not the same as redSphere

UFCEKU-20-3Web Games Programming Handling Events Initiated by Triggers This function is attached to the First Person Controller (Capsule Collider) function OnTriggerEnter(collisionInfo:Collider){ if(collisionInfo.gameObject.tag == "RedSphere"){ Debug.Log("I've gone through the Red Sphere!"); } if(collisionInfo.gameObject.tag == "BlueSphere"){ Debug.Log("I've deleted the Blue Sphere!"); Destroy(collisionInfo.gameObject); } Unity has a built in function for detecting collisions as triggers:

UFCEKU-20-3Web Games Programming Prefabs

UFCEKU-20-3Web Games Programming Camera Mesh Audio Listener The First Person Controller is a prefabricated object FPS.js Code to handle FPS Walker etc. Mesh collider Scripts

UFCEKU-20-3Web Games Programming Creating Prefabs In order to create a Prefab, simply drag a object that you've created in the scene into the Project View. The object's name will turn blue to show that it is a Prefab, then rename your new Prefab The object and all its ‘children’ have been copied into the Prefab data The Prefab can now be re-used in multiple instances The original object in the Hierarchy has now become an ‘instance’ of the new Prefab.

UFCEKU-20-3Web Games Programming Creating a Simple Prefab (Receive) Receive Receive.js Code to handle message sent by Transmit.js attached to sphere object Prefab created from the Receive cube by attaching a script.

UFCEKU-20-3Web Games Programming Spawning Objects

UFCEKU-20-3Web Games Programming Instantiate Command The Instantiate command has three parameters (arguments) Object to create, position to create it, rotation to give it: Instantiate(object,object’s position,object’s rotation);

UFCEKU-20-3Web Games Programming Instantiate Command Position and Rotation of objects to be instantiated must be specified as Vector3 values (X,Y,Z) used as follows: var aPrefab: GameObject;// variable of type GameObject Instantiate(aPrefab, Vector3(0,12,30), Vector3(0,0,90));

UFCEKU-20-3Web Games Programming Dummy Object Positioned in Scene at (0, 2, 5)

UFCEKU-20-3Web Games Programming Dummy Object Mesh Render Switched Off

UFCEKU-20-3Web Games Programming Camera Overlays

UFCEKU-20-3Web Games Programming Split - Viewport Camera Layouts

UFCEKU-20-3Web Games Programming Vertical Split-Screen x 0, y 0 Height (0.5) Width (1) Viewport

UFCEKU-20-3Web Games Programming Creating Camera Overlays

UFCEKU-20-3Web Games Programming Camera Depth Order cameraOne depth order = 0 cameraTwo depth order = 1 result

UFCEKU-20-3Web Games Programming Adjust Depth - in the Inspector Window

UFCEKU-20-3Web Games Programming Overlay and Scaling Scaled camera window overlay on main camera could be used as a follow overhead camera to aid character navigation in the world

UFCEKU-20-3Web Games Programming Heads-Up Displays (HUDS)

UFCEKU-20-3Web Games Programming Steps Required to Establish a HUD Acquire or create art work in an appropriate format Import the HUD artwork via Asset- Import New Asset Create a GUI Texture Game Object and associate the artwork with the texture object Position the HUD components in the interface Create scripts which initialize and update the HUD based on world states and events Attach scripts to objects that change world state and trigger events which update values in the appropriate HUD script

UFCEKU-20-3Web Games Programming HUD Declaration and Initialization public variables associated with textures

UFCEKU-20-3Web Games Programming Updating the HUD via Scripts (BatteryCollect.js) // static variable is accessible by other scripts i.e. its // variable scope is global static var charge:int = 0; var charge1tex:Texture2D; var charge2tex:Texture2D; var charge3tex:Texture2D; var charge4tex:Texture2D; var charge0tex:Texture2D; // initialise GUI texture to false (don't display it) function Start(){ guiTexture.enabled = false; charge = 0; } This script is attached to the GUI Texture GameObject

UFCEKU-20-3Web Games Programming /* the Update function checks status of charge variable which is increased via an external script each time the player collides (collects) with a battery */ function Update () { /* first battery collected assign the first texture image to guiTexture and enable (display) texture */ if(charge == 1){ guiTexture.texture = charge1tex; guiTexture.enabled = true; } // display subsequent textures to indicate power collected else if(charge == 2){ guiTexture.texture = charge2tex; } // etc. Updating the HUD via Scripts

UFCEKU-20-3Web Games Programming Updating the HUD via Scripts (PlayerCollisions.js) function Start () { } function Update () { } function OnTriggerEnter(collisionInfo : Collider){ if(collisionInfo.gameObject.tag == "battery"){ BatteryCollect.charge++; Destroy(collisionInfo.gameObject); } This script is attached to the First Person Controller

UFCEKU-20-3Web Games Programming Publishing for the Web

UFCEKU-20-3Web Games Programming Choose File – Build Settings… 1. Choose Web Player 2. Add Current Scene 3. Choose Build

UFCEKU-20-3Web Games Programming Check Colour and Layout of HTML Page Unity will create a default html page for your web player and save them both to a common folder with the name you chose after selecting build. You will need to edit the file to remove unwanted text, provide an appropriate html page title, adjust layout, and change page background colour.

UFCEKU-20-3Web Games Programming Publish to your UWE Student Module Homepage and make sure to test everything is working. Ask a fellow student to access your page from their account to ensure file permissions are correctly set. Publish and Test!