SlideShare ist ein Scribd-Unternehmen logo
1 von 60
UCHECHUKWU PHILEMON MIRACLE OBIMMA
A Beginners guide to
Virtual Reality (VR) Using Unity
3D and C# scripting
GETTING STARTED WITH IMMERSIVE TCHNOLOGIES
CONTENT TABLE
1. INTRODUCTION
2. JDK INSTALLATION
3. ANDROID SDK INSTALLATION
4. INTRODUCTION TO VR / AR SDK’s AND TOOLs
5. INTRODUCTION TO UNITY
6. SETTING UP A VR PROJECT
7. INTRODUCTION TO SCRIPTING USING C#
8. PHYSICS
9. BUILDING FINISHED APPS
10. SUMMARY
About Me
Contact info:
Twitter: philshisquare
Email: philshisquare@gmail.com
Phone: +2348108400434
Simply an earthling with an innate holy curiosity.
“EVERYONE IS A GENIUS; BUT IF YOU JUDGE A FISH BY ITS ABILITY TO CLIMB A
TREE, IT WILL LIVE THE REST OF ITS LIFE BELIEVING THAT IT IS STUPID”
_ Albert Einstein
INTRODUCTION
Immersive technologies are fast growing in relevance. With applications in construction, media, entertainment,
gaming, education and many other areas yet to be fully developed, the future of experience looks immersive. This is
a pointer to the need for people to develop relevant skills in this field. Examples of immersive technologies include;
 Virtual Reality (VR) is an immersive experience that presents you an unreal but not imaginary environment.
Simply put, it is an experience that takes you to an entirely new environment without any connection or contact
with your immediate environment.
 Augmented Reality (AR) is an experience where the real world is enhanced or emphasized by computer
generated graphics. This means that one will see the real world but with overlays of computer generated
graphics.
 Mixed Reality (MR) in simple terms is a system or software that incorporates the two technologies discussed
above. It is however closer in looks and operations to AR.
 Augmented Virtuality (AV) is unlike VR, it is an immersive experience of a real world familiar to a person not any
other imaginary or abstract location. For example, having your room or entire house built into a VR app; but it’s
still the very same thing in reality but just that you now see it in VR.
To create these software, there is need for some frameworks, engines, packages and tools. For the scope of this
study, we will use Unity 3D as game engine, android SDK and JDK as some external tools. In subsequent pages, we
will walk through the installation process of these tools and frameworks.
JDK
JAVA DEVELOPMENT KIT
1. Download JDK
the official java site looks like this
2. Access The Installation Folder
Open program files and trace it to the JDK bin folder.
3. Copy The Installation Folder Path
when in the bin folder, copy the entire path.
4. Open Systems Properties
Go to “This PC” right click and select properties.
5. Edit environment variables
Click “Advanced system settings” , >>
“environment variables” >> select “path” under
system variables; a new window opens.
A
B
C
D
E
6. Paste the Path Copied
In the “edit environment variable” window, click “New” then paste the link you already copied and click “OK”
7. JRE (Optional)
It is not compulsory but you can copy
the path to the JRE and paste into the
path window by same steps above.
8. Verify Installation with CMD
Open command line. Type; “java -
version” then enter. Also, “javac -
version” then enter.
ANDROID
SDK
SOFTWARE DEVELOPMENT KIT
1. Download SDK
the official android SDK site looks like this
2. Extract the Downloaded SDK File
Locate the file you downloaded from the
SDK site, extract it in other to gain access to
its content. This is because it comes zipped.
3. Open command line
Locate the bin folder. Once inside, open the
command line (CMD) by pressing Shift +
right click then select “open command
window here”.
4. Running Commands
Once the command line opens,
type “sdkmanager”, press enter.
It opens with few detail about
your SDK. This is a testimony
that everything is working fine.
NB: internet connection is
required.
5. Listing and Installing Packages
Type “sdkmanager --list”. This lists all the
packages available in the SDK. To install a
package, (platform tools for example) type
“sdkmanager platform-tools”. License agreement
comes up; type “y” to accept and wait for
installation to complete. DONE!
SUMMARY OF JDK AND SDK CONFIGURATION
When you have successfully set up your JDK and SDK, unity should automatically locate the position of the kits in your
computer. However, if this doesn’t happen automatically, follow these steps to set it up yourself.
Go to Edit >> Preferences…. >> External Tools. Scroll down; under “Android”, you will see SDK, JDK and NDK. For each
of them except NDK (which is optional), click on “Browse”. File explorer opens, then locate the position of the kits in
your computer.
TOOLS AND SDK’s
VIRTUAL REALITY
INTRODUCTION TO VR / AR SDK’s AND TOOLs
Tools: There are tools and software used to building immersive technologies apps.
The two major game engines used are Unity 3D and Unreal. These techs are cool. In
my opinion however, Unity is very popular among developers due to its flexibility and
“compact program coordination”. The programming languages available for writing
apps in Unity include C#, Java Script and Boo. C# a high compact programming
language is widely used for scripting in game development.
To write the code, an IDE (Integrated Development Environment) is needed. In current
versions of unity, Microsoft Visual studio 2017 is the coding environment that comes
stack with Unity. Suffice it to say that Unity used to come with Mono-develop (which
also is an IDE used to write code). One might also use later versions of visual studio for
scripting.
SDK’s
To build either an AR, VR or MR apps, you need what is called the SDK (Software Development Kit). Here are some
SDK's for developing for different platforms.
 Vuforia SDK
 ARCore (AR for android from google)
 ARKit (AR for IOS from apple)
 Wikitude SDK
 Oculus SDK (used for gear VR and oculus rift)
 Google VR SDK
It is also important to say that the android SDK and JDK (Java Development Kit) is required to build apps for
android. The list continues...
It is however imperative to know that some other companies like magic leap have their own new SDK and motion
controllers. (Topic for another day). There are also APIs (Application Program Interfaces) that come in handy for AR
apps. Example of which is the google poly API (free and easy to use).
UNITY 3D
INTRODUCTION TO UNITY
Unity 3D is a game engine; a game engine is a framework for game development. Frameworks
possesses already or pre made attributes required to make games. There are three core areas of
game development engines or frameworks. They are:
Graphics
Audio
Logic
However, modern game engines like Unity have become more specialized and commonly include
frameworks for physics, AI, networking, optimization etc. in simple terms, a framework has all the
assets and properties a game requires to function and optimize operation. This means you don’t
have to reinvent the wheel each time you start a new project. Furthermore, some game companies
build their own game engines to meet their specification but to save time and in other to tap into its
vast community of developers among other reasons, we choose the game engine called Unity 3D.
The makers of this ‘awesome’ game engine is a company called Unity technologies. Its onboard
physics engine; physX is made by another company named Nvidia.
OTHER GAME ENGINES
………..INTRODUCTION TO UNITY continued
First use: After downloading and installing unity, ensure that the following packages were also downloaded
and installed.
1. Android or IOS support
2. Vuforia AR support
3. Unity documentation (I strongly recommend this).
Click the unity icon to launch unity. A login or register page comes up, follow the prompt to sign up (this
requires internet connection) or sign in if you already have an account. When you sign in, you can turn off
internet connection. A page as shown below will be displayed.
1
………..INTRODUCTION TO UNITY continued
2 This window opens.
Here, click “new” to
create a new project or
“open” to select from
already existing
projects.
NB: the projects seen
here are my personal
projects. They will not
show up on your screen
when you run unity.
However, if you already
have a unity project,
they will show up here.
………..INTRODUCTION TO UNITY continued
3
4
Immersive technology apps are 3D in nature. Therefore,
choose the 3D template from the drop down menu.
Finally, click on “create project”. This automatically
creates the project and opens the unity environment for
you. NB: this might take few minutes depending on your
computers processing power.
………..INTRODUCTION TO UNITY continued
The Unity Environment and Windows
The
Hierarchy
The Scene
The
Inspector
The Game
The
Project
The
Console
VR PROJECT SETUP
SETTING UP A VR PROJECT
To start building a VR project, you need to switch your build platform to android or
IOS. For this illustration, we will use android. It is however, the same for iOS.
SETTING UP A VR PROJECT continued………
Importing packages: to import packages
e.g. google VR SDK. Right click “Assets”,
select “Import packages” then, “custom
packages”.
A file explorer window opens. Locate the folder
where the SDK is kept, then click “open”.
1 2
SETTING UP A VR PROJECT continued………
This window appears. Do not uncheck anything. Click import. This imports
the entire asset into your project in a folder called “Google VR”. However,
when you are sure of your skills, you can uncheck any asset you do not need.
SETTING UP A VR PROJECT continued………
To have the VR headset feel in your own scene, you need the “GvrEditorEmulator”. This is the new method after the release
of GoogleVRForUnity_1.40.0 edition. Copy the emulator and paste into the hierarchy of your own project. This turns your
regular camera to VR headset camera. To access the emulator, Go to “Assets” >> GoogleVR >> Demos >> Scenes then double
click “HelloVR”. Select “GvrEditorEmulator”; right click and copy.
Copy this
SETTING UP A VR PROJECT continued………
Navigate to your own scene and paste the
emulator in your project hierarchy. It will appear
in blue as shown here.
To fine your scene, go to “Assets”, click “scenes”
then launch (double click) “SampleScene”.
INTRODUCTION TO SCRIPTING USING C#
CREATING A C SHARP SCRIPT
To create a C# script, right click on “Assets” or any folder of your choice, select “Create” then click on “C# Script”. This
brings a new file into your Assets folder. Name the file based on the function you want the script to perform (the name
becomes the class name); click enter, then double click the file, automatically it opens Microsoft visual studio (or
Monodevelop); an environment where you write your code.
In the coming pages, we
will learn about the best
naming practices.
THE IDE; VISUAL STUDIO
DEFAULT LOOK OF THE CODE
WINDOW ONCE OPEN
Name spaces
Class declaration
and inheritance
Default function called once
the game starts.
Default function called
once every frame
VARIABLES AND NAMING
As shown in the given picture, variables are used to
hold values to be used in other places or at a later
time. In C#, a variable is declared by putting the
type, followed by the variable name then the
assignment sign, assigned value and the compulsory
semi-colon. However, as we will see later, the
assignment sign and values must not always be
present at every variable declaration.
Examples of data types;
 Integer = int
 Float
 String
 Boolean = bool etc.
Naming: the proper way of naming involves the
use of camel casing and the art of calling the
variable or function name by the function it is to
perform. E.g ; TimeOfStart, PlayerScore, etc. Notice
that every first later of each word is capital.
FUNCTIONS OR METHODS
Functions AKA methods are somewhat
a special kind of variables.
They are like variables in that they hold
values and can be used in other places
within the code. However, functions
are not variables.
In simple terms, functions are
mechanisms that store lines of code
(instructions) so that they have more
flexibility and generic use.
Making a function: “Void” or a data
type starts, it is followed by the desired
function name, a pair of parenthesis
and curry braces. The code is written
inside the braces
This is an example of a
function that has just the
void keyword. It is not
expected to return any
“tangible” data such
integer, float or Boolean.
An example of a function
with a data type. This
example is expected to
return a string data type.
Another example might
return any other data
type. Note the keyword
“Return”.
CLASSES
In game development or any other app
development which uses the unity engine
name space, every script created is a class
which inherits from MonoBehaviour. This
makes it possible for one to access all the
built in methods and properties of the
MonoBehaviour class. In addition, no matter
the number of scripts in a game, the source
script must inherit from MonoBehaviour.
A class however, offers a way to group
functions and variables of different operations
but same overall goal such that any content of
the class can be called from any other script
which inherits from it or which gets its script
component.
OPERATORS
NB: “=” (single equality sign) is an assignment symbol
OPERATORS AND CONDITIONALS
The figure by the right shows the structure of if, else if and else
statements.
If statement: the “if” keyword is followed by a pair of brackets (which
contain the conditions), a pair of curry brace, inside which the code is
written.
Else if: same structure as if statement. However, it has to come under if
statements when it is needed; as it is only called if the if statement’s
condition fails.
Else: contains no conditions. It holds instructions to be done when if or
else if or both fails.
VECTORS
Every object in the world is defined by
all or one of its location, scale or
rotation. These transform component
as it is identified in unity, is found in
axes. In 2D world, objects are in x and y
axes while in 3D, they are in x, y and z
axes. These parameters are stored in
unity C# as Vector2 and Vector3
respectively. Since we are focused on
3D, we will learn more about Vector3.
The figure above illustrates how the three transform
component in unity interacts with vector3.
Notice that we used localScale instead of scale and
eulerAngles instead of rotation. This is because;
 The keyword scale exists in unity for a different
purpose.
 In the case of rotation, it is a quaternion therefore,
unity created eulerAngles to convert a Vector3 to
quaternion.
VECTORS Continued…….
Values can be assigned to
the various axes (.x, .y, .z) of
vectors.
Vector Arithmetic
Creating a vector3
NB: Unity also have provision for Vector4
PUBLIC AND PRIVATE VARIABLES
As shown in the two images below, when variables are declared with the public
keyword, they show inside unity in the inspector and can be edited even at run time.
When a public
variables is not
wanted to show
in unity, it is
hidden as shown
in the image by
the left
Also, a private
variable can be
made to show in
inspector as
shown in this
code.;
INPUT METHOD
The input property is used in unity C
sharp scripting to receive commands
from the user. Once the keyword input
is entered followed by a full stop, a list
of the users input modes are
automatically displayed. However, in
building for VR, google cardboard
especially, we use the
“GetMouseButton….” input modes
shown on the screen.
GetMouseButton: concerned with the
first button press.
GetMouseButtonDown: concerned
with when the button is pressed down
and held.
GetMouseButtonUp: concerned with
when the button is released.
OBJECT INTERACTION
Used to cause a trigger on an object. This
makes it possible for an object to go
through another without destroying it.
Used to interact or rub against another
object. Collision is same as the word
implies but there must be a collider and
a Rigidbody component (which we will
see later) for this to work.
GetComponent as the name implies
is a property used to get the
component of other game objects
which must be referenced to it by
script.
ARRAYS
Arrays are data structures that are used to
store multiple information such as
variables, game objects, etc. One of the
methods of creating an array is shown
below
A ray cast is used to sight and communicate with a
distant object. It is like the human vision. The ray
is your line of sight. The RayCastHit is a datatype
used to store the information of your view. E.g.. A
wall, car, etc. The code above is an example for ray
casting. It can be under its own function or in side
the update or start function directly.
CONDITIONALS
A for loop is a conditional that executes its instruction as long as its condition is true.
Structure Example
CONDITIONALS
While loop
Do… while
foreach
SUMMARY OF CONDITIONALS
COROUTINES
At times we might want to call a
given function but after a given
period of time. This is what the
Coroutine property is used for. It
allows you the liberty to call a
function after few time units of
delay.
It is important to know that this
property is not a member of the
standard C# library. It is only present
due the unity engine namespace
and MonoBehaviour.
The code in the picture shows the
syntax for writing coroutines.
PHYSICS
COLLIDERS AND RIGIDBODY
These are the main members of the unity physics engine. The box
collider is used to handle collision. Every game object in unity has one of
the numerous colliders in unity. Examples of colliders include: box, mesh,
sphere, capsule collider etc.
Rigidbody refers to the physics interaction of a game object. It has some
features as shown in the picture.
Mass: the total weight (earth pull of gravity) of a body
Drag: the associated air resistance a body experiences
Angular drag: same as drag but from an angle
Use gravity: this makes it possible for a body or game object to be
affected by gravity. When unchecked, a body will not fall under the
influence of gravity.
Other components are essential but we will limit our discussion to these.
The constraints are used to lock rotation or position at any given axis.
New components can be added using the “Add Component” button.
CREATING PHYSICS MATERIALS
Select a folder of choice,
right click then select
“Physic Material”. A
material icon comes up;
name it a double click on
it to launch it. The
window by the right
opens, edit the
parameters as it would
reflect the type of
material you want to
create. When finished,
select the game object to
carry the material; under
its collider component,
drag and drop the
created material in the
material port.
These parameters can be used to
produce any kind of material one can
possibly think of. However, these
words have same meaning as they
have in physics.
BUILDING FINISHED APPS
Open build settings (as
explained before). Click on
Player Settings. The player
settings window opens in the
inspector. Affect the changes as
will be shown in the next slide.
BUILDING FINISHED APPS
Edit company name.
it can be your
business name or any
other name of your
own choosing. The
product name should
be your app name.
Import an image to be
used as app icon and
select it.
Under XR settings
check the VR
supported box, then
use the plus sign to
add either cardboard
or any other as SDK,
depending on the VR
system you will use
the app on
Here, choose the
minimum API
(which is API 19 for
VR apps). Set up
your package name.
Use your company
name (the one you
already used at the
beginning) and
product name. Your
package name is
your unique
identifier in the play
store among all
other apps. You
must set it, failure
to do so, your app
will not build
BUILDING FINISHED APPS
BUILDING FINISHED APPS
When you have finished the player settings, click Build; a file explorer window opens for
you to save your app as APK. If you click “Build And Run”, ensure you have your phone
connected via USB. The app is built and launched in your phone immediately.
SUMMARY
I honestly hope that this document has been of tremendous in getting you started with virtual
reality in C# and Unity. However, the topics and concepts captured here are as insignificant as
a cup of water in the ocean. By this, I encourage you to expand your knowledge. Try your
hands on other concepts, use other materials and most importantly, practice on your own.
There are some concepts that were left out of this study because we aimed at pushing a pure
novice to a beginners level of understanding in VR development with the above explained
concepts. Be not afraid to try new things. We hope to produce a more advanced edition of
this presentation in its second volume.
REFERENCES
Introduction to game development using unity and C# by Sebastian Lague
URL: www.patreon.com/SebastianLague
Google.com and youtube.com
THANK YOU

Weitere ähnliche Inhalte

Was ist angesagt?

Os eclipse-androidwidget-pdf
Os eclipse-androidwidget-pdfOs eclipse-androidwidget-pdf
Os eclipse-androidwidget-pdf
weerabahu
 
Callum deighton engine terminology
Callum deighton engine terminologyCallum deighton engine terminology
Callum deighton engine terminology
Deightonater
 
android-tutorial-for-beginner
android-tutorial-for-beginnerandroid-tutorial-for-beginner
android-tutorial-for-beginner
Ajailal Parackal
 
Connor martin Y1 GD Engine Terminology
Connor martin Y1 GD Engine TerminologyConnor martin Y1 GD Engine Terminology
Connor martin Y1 GD Engine Terminology
Kalen612
 
Eclispe daytoulouse combining the power of eclipse with android_fr_1024_768_s...
Eclispe daytoulouse combining the power of eclipse with android_fr_1024_768_s...Eclispe daytoulouse combining the power of eclipse with android_fr_1024_768_s...
Eclispe daytoulouse combining the power of eclipse with android_fr_1024_768_s...
Mathias Seguy
 

Was ist angesagt? (20)

Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspective
 
Android App development I
Android App development IAndroid App development I
Android App development I
 
Os eclipse-androidwidget-pdf
Os eclipse-androidwidget-pdfOs eclipse-androidwidget-pdf
Os eclipse-androidwidget-pdf
 
Android App Development Intro at ESC SV 2012
Android App Development Intro at ESC SV 2012Android App Development Intro at ESC SV 2012
Android App Development Intro at ESC SV 2012
 
Android chapter02-setup2-emulator
Android chapter02-setup2-emulatorAndroid chapter02-setup2-emulator
Android chapter02-setup2-emulator
 
Android Development Workshop
Android Development WorkshopAndroid Development Workshop
Android Development Workshop
 
Sikuli script
Sikuli scriptSikuli script
Sikuli script
 
Callum deighton engine terminology
Callum deighton engine terminologyCallum deighton engine terminology
Callum deighton engine terminology
 
Android OS
Android OSAndroid OS
Android OS
 
android studio
 android studio android studio
android studio
 
Intel ndk - a few Benchmarks
Intel ndk - a few BenchmarksIntel ndk - a few Benchmarks
Intel ndk - a few Benchmarks
 
Android Development: Build Android App from Scratch
Android Development: Build Android App from ScratchAndroid Development: Build Android App from Scratch
Android Development: Build Android App from Scratch
 
android-tutorial-for-beginner
android-tutorial-for-beginnerandroid-tutorial-for-beginner
android-tutorial-for-beginner
 
Android Development Tutorial V3
Android Development Tutorial   V3Android Development Tutorial   V3
Android Development Tutorial V3
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
 
Devraj_Nataraj_CV_PDF
Devraj_Nataraj_CV_PDFDevraj_Nataraj_CV_PDF
Devraj_Nataraj_CV_PDF
 
Connor martin Y1 GD Engine Terminology
Connor martin Y1 GD Engine TerminologyConnor martin Y1 GD Engine Terminology
Connor martin Y1 GD Engine Terminology
 
Eclispe daytoulouse combining the power of eclipse with android_fr_1024_768_s...
Eclispe daytoulouse combining the power of eclipse with android_fr_1024_768_s...Eclispe daytoulouse combining the power of eclipse with android_fr_1024_768_s...
Eclispe daytoulouse combining the power of eclipse with android_fr_1024_768_s...
 
9780134433646 annuzzi ch02 (1)
9780134433646 annuzzi ch02 (1)9780134433646 annuzzi ch02 (1)
9780134433646 annuzzi ch02 (1)
 
Dot Net Project Mini Game
Dot Net Project Mini GameDot Net Project Mini Game
Dot Net Project Mini Game
 

Ähnlich wie Getting started with immersive technologies

Android 3D by Ivan Trajkovic and Dotti Colvin
Android 3D by Ivan Trajkovic and Dotti ColvinAndroid 3D by Ivan Trajkovic and Dotti Colvin
Android 3D by Ivan Trajkovic and Dotti Colvin
swengineers
 

Ähnlich wie Getting started with immersive technologies (20)

Augmenting reality: Bring digital objects into the real world
Augmenting reality: Bring digital objects into the real worldAugmenting reality: Bring digital objects into the real world
Augmenting reality: Bring digital objects into the real world
 
Bird.pdf
 Bird.pdf Bird.pdf
Bird.pdf
 
Final NEWS.pdf
Final NEWS.pdfFinal NEWS.pdf
Final NEWS.pdf
 
Final NewsApp.pdf
Final NewsApp.pdfFinal NewsApp.pdf
Final NewsApp.pdf
 
Android wear notes
Android wear notesAndroid wear notes
Android wear notes
 
Webinar on Google Android SDK
Webinar on Google Android SDKWebinar on Google Android SDK
Webinar on Google Android SDK
 
How to start designing for Apple Vision Pro
How to start designing for Apple Vision ProHow to start designing for Apple Vision Pro
How to start designing for Apple Vision Pro
 
androidstudio.pptx
androidstudio.pptxandroidstudio.pptx
androidstudio.pptx
 
The Basics of Unity - The Game Engine
The Basics of Unity - The Game EngineThe Basics of Unity - The Game Engine
The Basics of Unity - The Game Engine
 
Android course (lecture2)
Android course (lecture2)Android course (lecture2)
Android course (lecture2)
 
Introduction_to_android_and_android_studio
Introduction_to_android_and_android_studioIntroduction_to_android_and_android_studio
Introduction_to_android_and_android_studio
 
Getting Enter in Android development
Getting Enter in Android developmentGetting Enter in Android development
Getting Enter in Android development
 
How to Create a VR Game in unity 3D
How to Create a VR Game in unity 3DHow to Create a VR Game in unity 3D
How to Create a VR Game in unity 3D
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android Application Development Environment Setup
Android Application Development Environment SetupAndroid Application Development Environment Setup
Android Application Development Environment Setup
 
Android 3D by Ivan Trajkovic and Dotti Colvin
Android 3D by Ivan Trajkovic and Dotti ColvinAndroid 3D by Ivan Trajkovic and Dotti Colvin
Android 3D by Ivan Trajkovic and Dotti Colvin
 
unity gaming programing basics for students ppt
unity gaming programing basics for students pptunity gaming programing basics for students ppt
unity gaming programing basics for students ppt
 
How to develop a Flutter app.pdf
How to develop a Flutter app.pdfHow to develop a Flutter app.pdf
How to develop a Flutter app.pdf
 
Installing android sdk on net beans
Installing android sdk on net beansInstalling android sdk on net beans
Installing android sdk on net beans
 
Introduction to html5 game programming with ImpactJs
Introduction to html5 game programming with ImpactJsIntroduction to html5 game programming with ImpactJs
Introduction to html5 game programming with ImpactJs
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 

Getting started with immersive technologies

  • 1. UCHECHUKWU PHILEMON MIRACLE OBIMMA A Beginners guide to Virtual Reality (VR) Using Unity 3D and C# scripting GETTING STARTED WITH IMMERSIVE TCHNOLOGIES
  • 2. CONTENT TABLE 1. INTRODUCTION 2. JDK INSTALLATION 3. ANDROID SDK INSTALLATION 4. INTRODUCTION TO VR / AR SDK’s AND TOOLs 5. INTRODUCTION TO UNITY 6. SETTING UP A VR PROJECT 7. INTRODUCTION TO SCRIPTING USING C# 8. PHYSICS 9. BUILDING FINISHED APPS 10. SUMMARY
  • 3. About Me Contact info: Twitter: philshisquare Email: philshisquare@gmail.com Phone: +2348108400434 Simply an earthling with an innate holy curiosity.
  • 4. “EVERYONE IS A GENIUS; BUT IF YOU JUDGE A FISH BY ITS ABILITY TO CLIMB A TREE, IT WILL LIVE THE REST OF ITS LIFE BELIEVING THAT IT IS STUPID” _ Albert Einstein
  • 5. INTRODUCTION Immersive technologies are fast growing in relevance. With applications in construction, media, entertainment, gaming, education and many other areas yet to be fully developed, the future of experience looks immersive. This is a pointer to the need for people to develop relevant skills in this field. Examples of immersive technologies include;  Virtual Reality (VR) is an immersive experience that presents you an unreal but not imaginary environment. Simply put, it is an experience that takes you to an entirely new environment without any connection or contact with your immediate environment.  Augmented Reality (AR) is an experience where the real world is enhanced or emphasized by computer generated graphics. This means that one will see the real world but with overlays of computer generated graphics.  Mixed Reality (MR) in simple terms is a system or software that incorporates the two technologies discussed above. It is however closer in looks and operations to AR.  Augmented Virtuality (AV) is unlike VR, it is an immersive experience of a real world familiar to a person not any other imaginary or abstract location. For example, having your room or entire house built into a VR app; but it’s still the very same thing in reality but just that you now see it in VR. To create these software, there is need for some frameworks, engines, packages and tools. For the scope of this study, we will use Unity 3D as game engine, android SDK and JDK as some external tools. In subsequent pages, we will walk through the installation process of these tools and frameworks.
  • 7. 1. Download JDK the official java site looks like this
  • 8. 2. Access The Installation Folder Open program files and trace it to the JDK bin folder. 3. Copy The Installation Folder Path when in the bin folder, copy the entire path.
  • 9. 4. Open Systems Properties Go to “This PC” right click and select properties. 5. Edit environment variables Click “Advanced system settings” , >> “environment variables” >> select “path” under system variables; a new window opens.
  • 10. A B C D E 6. Paste the Path Copied In the “edit environment variable” window, click “New” then paste the link you already copied and click “OK”
  • 11. 7. JRE (Optional) It is not compulsory but you can copy the path to the JRE and paste into the path window by same steps above. 8. Verify Installation with CMD Open command line. Type; “java - version” then enter. Also, “javac - version” then enter.
  • 13. 1. Download SDK the official android SDK site looks like this
  • 14. 2. Extract the Downloaded SDK File Locate the file you downloaded from the SDK site, extract it in other to gain access to its content. This is because it comes zipped. 3. Open command line Locate the bin folder. Once inside, open the command line (CMD) by pressing Shift + right click then select “open command window here”.
  • 15. 4. Running Commands Once the command line opens, type “sdkmanager”, press enter. It opens with few detail about your SDK. This is a testimony that everything is working fine. NB: internet connection is required. 5. Listing and Installing Packages Type “sdkmanager --list”. This lists all the packages available in the SDK. To install a package, (platform tools for example) type “sdkmanager platform-tools”. License agreement comes up; type “y” to accept and wait for installation to complete. DONE!
  • 16. SUMMARY OF JDK AND SDK CONFIGURATION When you have successfully set up your JDK and SDK, unity should automatically locate the position of the kits in your computer. However, if this doesn’t happen automatically, follow these steps to set it up yourself. Go to Edit >> Preferences…. >> External Tools. Scroll down; under “Android”, you will see SDK, JDK and NDK. For each of them except NDK (which is optional), click on “Browse”. File explorer opens, then locate the position of the kits in your computer.
  • 18. INTRODUCTION TO VR / AR SDK’s AND TOOLs Tools: There are tools and software used to building immersive technologies apps. The two major game engines used are Unity 3D and Unreal. These techs are cool. In my opinion however, Unity is very popular among developers due to its flexibility and “compact program coordination”. The programming languages available for writing apps in Unity include C#, Java Script and Boo. C# a high compact programming language is widely used for scripting in game development. To write the code, an IDE (Integrated Development Environment) is needed. In current versions of unity, Microsoft Visual studio 2017 is the coding environment that comes stack with Unity. Suffice it to say that Unity used to come with Mono-develop (which also is an IDE used to write code). One might also use later versions of visual studio for scripting.
  • 19. SDK’s To build either an AR, VR or MR apps, you need what is called the SDK (Software Development Kit). Here are some SDK's for developing for different platforms.  Vuforia SDK  ARCore (AR for android from google)  ARKit (AR for IOS from apple)  Wikitude SDK  Oculus SDK (used for gear VR and oculus rift)  Google VR SDK It is also important to say that the android SDK and JDK (Java Development Kit) is required to build apps for android. The list continues... It is however imperative to know that some other companies like magic leap have their own new SDK and motion controllers. (Topic for another day). There are also APIs (Application Program Interfaces) that come in handy for AR apps. Example of which is the google poly API (free and easy to use).
  • 21. INTRODUCTION TO UNITY Unity 3D is a game engine; a game engine is a framework for game development. Frameworks possesses already or pre made attributes required to make games. There are three core areas of game development engines or frameworks. They are: Graphics Audio Logic However, modern game engines like Unity have become more specialized and commonly include frameworks for physics, AI, networking, optimization etc. in simple terms, a framework has all the assets and properties a game requires to function and optimize operation. This means you don’t have to reinvent the wheel each time you start a new project. Furthermore, some game companies build their own game engines to meet their specification but to save time and in other to tap into its vast community of developers among other reasons, we choose the game engine called Unity 3D. The makers of this ‘awesome’ game engine is a company called Unity technologies. Its onboard physics engine; physX is made by another company named Nvidia.
  • 23. ………..INTRODUCTION TO UNITY continued First use: After downloading and installing unity, ensure that the following packages were also downloaded and installed. 1. Android or IOS support 2. Vuforia AR support 3. Unity documentation (I strongly recommend this). Click the unity icon to launch unity. A login or register page comes up, follow the prompt to sign up (this requires internet connection) or sign in if you already have an account. When you sign in, you can turn off internet connection. A page as shown below will be displayed. 1
  • 24. ………..INTRODUCTION TO UNITY continued 2 This window opens. Here, click “new” to create a new project or “open” to select from already existing projects. NB: the projects seen here are my personal projects. They will not show up on your screen when you run unity. However, if you already have a unity project, they will show up here.
  • 25. ………..INTRODUCTION TO UNITY continued 3 4 Immersive technology apps are 3D in nature. Therefore, choose the 3D template from the drop down menu. Finally, click on “create project”. This automatically creates the project and opens the unity environment for you. NB: this might take few minutes depending on your computers processing power.
  • 26. ………..INTRODUCTION TO UNITY continued The Unity Environment and Windows The Hierarchy The Scene The Inspector The Game The Project The Console
  • 28. SETTING UP A VR PROJECT To start building a VR project, you need to switch your build platform to android or IOS. For this illustration, we will use android. It is however, the same for iOS.
  • 29. SETTING UP A VR PROJECT continued……… Importing packages: to import packages e.g. google VR SDK. Right click “Assets”, select “Import packages” then, “custom packages”. A file explorer window opens. Locate the folder where the SDK is kept, then click “open”. 1 2
  • 30. SETTING UP A VR PROJECT continued……… This window appears. Do not uncheck anything. Click import. This imports the entire asset into your project in a folder called “Google VR”. However, when you are sure of your skills, you can uncheck any asset you do not need.
  • 31. SETTING UP A VR PROJECT continued……… To have the VR headset feel in your own scene, you need the “GvrEditorEmulator”. This is the new method after the release of GoogleVRForUnity_1.40.0 edition. Copy the emulator and paste into the hierarchy of your own project. This turns your regular camera to VR headset camera. To access the emulator, Go to “Assets” >> GoogleVR >> Demos >> Scenes then double click “HelloVR”. Select “GvrEditorEmulator”; right click and copy. Copy this
  • 32. SETTING UP A VR PROJECT continued……… Navigate to your own scene and paste the emulator in your project hierarchy. It will appear in blue as shown here. To fine your scene, go to “Assets”, click “scenes” then launch (double click) “SampleScene”.
  • 34. CREATING A C SHARP SCRIPT To create a C# script, right click on “Assets” or any folder of your choice, select “Create” then click on “C# Script”. This brings a new file into your Assets folder. Name the file based on the function you want the script to perform (the name becomes the class name); click enter, then double click the file, automatically it opens Microsoft visual studio (or Monodevelop); an environment where you write your code. In the coming pages, we will learn about the best naming practices.
  • 35. THE IDE; VISUAL STUDIO DEFAULT LOOK OF THE CODE WINDOW ONCE OPEN Name spaces Class declaration and inheritance Default function called once the game starts. Default function called once every frame
  • 36. VARIABLES AND NAMING As shown in the given picture, variables are used to hold values to be used in other places or at a later time. In C#, a variable is declared by putting the type, followed by the variable name then the assignment sign, assigned value and the compulsory semi-colon. However, as we will see later, the assignment sign and values must not always be present at every variable declaration. Examples of data types;  Integer = int  Float  String  Boolean = bool etc. Naming: the proper way of naming involves the use of camel casing and the art of calling the variable or function name by the function it is to perform. E.g ; TimeOfStart, PlayerScore, etc. Notice that every first later of each word is capital.
  • 37. FUNCTIONS OR METHODS Functions AKA methods are somewhat a special kind of variables. They are like variables in that they hold values and can be used in other places within the code. However, functions are not variables. In simple terms, functions are mechanisms that store lines of code (instructions) so that they have more flexibility and generic use. Making a function: “Void” or a data type starts, it is followed by the desired function name, a pair of parenthesis and curry braces. The code is written inside the braces This is an example of a function that has just the void keyword. It is not expected to return any “tangible” data such integer, float or Boolean. An example of a function with a data type. This example is expected to return a string data type. Another example might return any other data type. Note the keyword “Return”.
  • 38. CLASSES In game development or any other app development which uses the unity engine name space, every script created is a class which inherits from MonoBehaviour. This makes it possible for one to access all the built in methods and properties of the MonoBehaviour class. In addition, no matter the number of scripts in a game, the source script must inherit from MonoBehaviour. A class however, offers a way to group functions and variables of different operations but same overall goal such that any content of the class can be called from any other script which inherits from it or which gets its script component.
  • 39. OPERATORS NB: “=” (single equality sign) is an assignment symbol
  • 40. OPERATORS AND CONDITIONALS The figure by the right shows the structure of if, else if and else statements. If statement: the “if” keyword is followed by a pair of brackets (which contain the conditions), a pair of curry brace, inside which the code is written. Else if: same structure as if statement. However, it has to come under if statements when it is needed; as it is only called if the if statement’s condition fails. Else: contains no conditions. It holds instructions to be done when if or else if or both fails.
  • 41. VECTORS Every object in the world is defined by all or one of its location, scale or rotation. These transform component as it is identified in unity, is found in axes. In 2D world, objects are in x and y axes while in 3D, they are in x, y and z axes. These parameters are stored in unity C# as Vector2 and Vector3 respectively. Since we are focused on 3D, we will learn more about Vector3. The figure above illustrates how the three transform component in unity interacts with vector3. Notice that we used localScale instead of scale and eulerAngles instead of rotation. This is because;  The keyword scale exists in unity for a different purpose.  In the case of rotation, it is a quaternion therefore, unity created eulerAngles to convert a Vector3 to quaternion.
  • 42. VECTORS Continued……. Values can be assigned to the various axes (.x, .y, .z) of vectors. Vector Arithmetic Creating a vector3 NB: Unity also have provision for Vector4
  • 43. PUBLIC AND PRIVATE VARIABLES As shown in the two images below, when variables are declared with the public keyword, they show inside unity in the inspector and can be edited even at run time. When a public variables is not wanted to show in unity, it is hidden as shown in the image by the left Also, a private variable can be made to show in inspector as shown in this code.;
  • 44. INPUT METHOD The input property is used in unity C sharp scripting to receive commands from the user. Once the keyword input is entered followed by a full stop, a list of the users input modes are automatically displayed. However, in building for VR, google cardboard especially, we use the “GetMouseButton….” input modes shown on the screen. GetMouseButton: concerned with the first button press. GetMouseButtonDown: concerned with when the button is pressed down and held. GetMouseButtonUp: concerned with when the button is released.
  • 45. OBJECT INTERACTION Used to cause a trigger on an object. This makes it possible for an object to go through another without destroying it. Used to interact or rub against another object. Collision is same as the word implies but there must be a collider and a Rigidbody component (which we will see later) for this to work. GetComponent as the name implies is a property used to get the component of other game objects which must be referenced to it by script.
  • 46. ARRAYS Arrays are data structures that are used to store multiple information such as variables, game objects, etc. One of the methods of creating an array is shown below A ray cast is used to sight and communicate with a distant object. It is like the human vision. The ray is your line of sight. The RayCastHit is a datatype used to store the information of your view. E.g.. A wall, car, etc. The code above is an example for ray casting. It can be under its own function or in side the update or start function directly.
  • 47. CONDITIONALS A for loop is a conditional that executes its instruction as long as its condition is true. Structure Example
  • 50. COROUTINES At times we might want to call a given function but after a given period of time. This is what the Coroutine property is used for. It allows you the liberty to call a function after few time units of delay. It is important to know that this property is not a member of the standard C# library. It is only present due the unity engine namespace and MonoBehaviour. The code in the picture shows the syntax for writing coroutines.
  • 52. COLLIDERS AND RIGIDBODY These are the main members of the unity physics engine. The box collider is used to handle collision. Every game object in unity has one of the numerous colliders in unity. Examples of colliders include: box, mesh, sphere, capsule collider etc. Rigidbody refers to the physics interaction of a game object. It has some features as shown in the picture. Mass: the total weight (earth pull of gravity) of a body Drag: the associated air resistance a body experiences Angular drag: same as drag but from an angle Use gravity: this makes it possible for a body or game object to be affected by gravity. When unchecked, a body will not fall under the influence of gravity. Other components are essential but we will limit our discussion to these. The constraints are used to lock rotation or position at any given axis. New components can be added using the “Add Component” button.
  • 53. CREATING PHYSICS MATERIALS Select a folder of choice, right click then select “Physic Material”. A material icon comes up; name it a double click on it to launch it. The window by the right opens, edit the parameters as it would reflect the type of material you want to create. When finished, select the game object to carry the material; under its collider component, drag and drop the created material in the material port. These parameters can be used to produce any kind of material one can possibly think of. However, these words have same meaning as they have in physics.
  • 55. Open build settings (as explained before). Click on Player Settings. The player settings window opens in the inspector. Affect the changes as will be shown in the next slide. BUILDING FINISHED APPS
  • 56. Edit company name. it can be your business name or any other name of your own choosing. The product name should be your app name. Import an image to be used as app icon and select it. Under XR settings check the VR supported box, then use the plus sign to add either cardboard or any other as SDK, depending on the VR system you will use the app on Here, choose the minimum API (which is API 19 for VR apps). Set up your package name. Use your company name (the one you already used at the beginning) and product name. Your package name is your unique identifier in the play store among all other apps. You must set it, failure to do so, your app will not build BUILDING FINISHED APPS
  • 57. BUILDING FINISHED APPS When you have finished the player settings, click Build; a file explorer window opens for you to save your app as APK. If you click “Build And Run”, ensure you have your phone connected via USB. The app is built and launched in your phone immediately.
  • 58. SUMMARY I honestly hope that this document has been of tremendous in getting you started with virtual reality in C# and Unity. However, the topics and concepts captured here are as insignificant as a cup of water in the ocean. By this, I encourage you to expand your knowledge. Try your hands on other concepts, use other materials and most importantly, practice on your own. There are some concepts that were left out of this study because we aimed at pushing a pure novice to a beginners level of understanding in VR development with the above explained concepts. Be not afraid to try new things. We hope to produce a more advanced edition of this presentation in its second volume.
  • 59. REFERENCES Introduction to game development using unity and C# by Sebastian Lague URL: www.patreon.com/SebastianLague Google.com and youtube.com