Blender Modelling

Blender Modelling
Unity introduction
& Leap Motion Controller
Renato Mainetti
Jacopo Essenziale
renato.mainetti@unimi.it
jacopo.essenziale@unimi.it
Lab 05
Unity 3D Game Engine
2
Official Unity 3D Tutorials
• https://unity3d.com/learn/tutorials/
3
Interface Overview
Hierarchy
SceneView
GameView
Project panel
Inspector panel
4
Scene View:
•
•
•
•
•
•
•
qwert ->
Left mouse click = PAN
Right mouse click = Look around like FPS
Alt + Left = Orbit around your looking point
Alt + Right = Zoom
wer = position - rotation - scale
Center-Pivot, Global-Local
•
•
•
•
•
Focus to an object: dbl-click in hierarchy or press f
Several display mode (Shaded,wireframe, etc…)
Search scene, fade out all the other objects
Light on, sky and audio preview
Perspective 3D view to Ortho
5
Game View:
• Active when play button is pressed
• When in play mode every change is not saved
• Paused and stepping forward frame by frame
• Aspect ratio and resolution (to test deploy platforms)
6
Hierarchy Panel:
• If the parent is the world, RTS relatively to the world
• If it’s child, RTS relatively to it’s parent
• Create button is the mirror of game object – create other
• Search like the one in the hierarchy view
• Search could be filtered by type: t:Light, t:AudioSource
7
Project Panel:
• Mirror of the Asset folder
• Used to organize all the assets
• New object could be imported(into the folder or by drag
and drop) or created by right click mouse
• Search for assets
• Thumbnail using the zoom slider
• Filter by type, groups, it is also possible to add your own
group
8
Inspector Panel:
• Contextual
• Static flag is used for static object in the scene (used to
bake light, evaluate navigation path, etc.)
• Tag (find objects by code)
• Layer (render, collsion, etc.)
• Property specific to the current selected object
(drag, click, reset)
• Lock object properties
9
Asset store:
10
Game Object:
• Populate the Unity scene (visible in the hierarchy)
• Game object are made up by several components that could be
added through menu component add, or through the add
component button in the inspector
• Every game object (also an empty) has a transform component
• The game object could be activated/deactivated
• Component could be added to the game object
• Component could also be copied and pasted to another game
object
11
Physics:
• Add a plane
• Add a terrain collider to the plane
• Add a cube
• The default cube already has a box collider attached
• Add a Rigid Body component (Physics)
• Run the scene
12
Import Blender models into Unity3D:
Blender models could be imported into Unity 3D:
• You can export the model from Blender using the .fbx format
• You can drag the .blend file into the Assets folder (blender required)
Unity uses blender to auto export an fbx.
13
Scripting:
Two languages could be used as scripting language in
blender:
• C# (most used – the preferred ones)
• JS
• Scripts are mainly used to implement the game
mechanics
• They could also be used to customize the editor or to
create for example PCG.
• A script could be attached to a game object dragging it
over the inspector or using the component add menu
14
Scripting:
• Two important methods:
• Start() -> called when the object is initialized
• Update() -> called once per frame
• How to move a cube?
Void Update()
{
transform.Translate(new Vector3(1.0f, 0.0f, 0.0f));
}
15
Scripting:
• Two important methods:
• Start() -> called when the object is
• Update() -> called once per frame
• How to move a cube, fps independent way?
Void Update()
{
Debug.Log(Time.deltaTime);
transform.Translate(new Vector3(Time.deltaTime, 0.0f, 0.0f));
}
16
UI: a simple score viewer:
17
Prefab:
• To store a game object into the project we could
create a prefab
• To create a prefab simply drag the game object
from the scene view to the asset folder
• The prefab could then be instantiated runtime or
added again to the scene
18
Deploy:
19
Leap Motion Controller
https://www.leapmotion.com
20
An Hand Tracking Device
• It allow us to track the position of the user hand in
real-time, pretty much like kinect do with our body.
• It’s specialized in hand tracking, we can get the
position of each bone of our fingers!
• It’s very fast! (up to 300 fps, consider that kinect 2
RGB camera works at 30fps).
• It’s simple (both in design and ease of use).
• It’s cheap! You can get one for 70€!
21
HARDWARE (1/2)
Inside the leap
• 3 Infrared (IR) leds
• 2 IR wide angle cameras
Thanks to the wide angle lenses of
the camera the leap motion is able
to monitor an imaginary interaction
box of 60 w x 60 h x 60 d cm.
22
HARDWARE (2/2)
How does it work?
http://blog.leapmotion.com/hardware-to-software-how-does-the-leap-motion-controller-work/
Leds light up the scene with IR light (outside human visible
spectrum), both cameras capture the image.
The intersection of the binocular cameras field of view
creates a shape of an inverted pyramid which defines our
interaction area
23
SOFTWARE
The real magic happen here…
• Hardware just send simple raw images to Leap
Motion runtime service through the USB cable
• Images are processed using CV algorithms to
reconstruct 3d position of what the camera sees.
• Techniques are pretty similar to the ones seen last
time in MOCAP: we got two images, we try to
detect the same point in both of them and then we
triangulate to detect position.
• Software also tries to infer occluded objects
position.
• Some filtering is used to guarantee data coherence
between frames.
24
SDK + Unity Assets
https://developer.leapmotion.com/sdk/v2
• Leap Motion provides an easy to use SDK to access
controller data within your applications
• Supported languages:
• C++
• C#
• Objective C
• Java
• Python
• JavaScript
https://developer.leapmotion.com/documentation/
• Some useful assets for game engines are also
provided, we’ll have a look at them in a moment!
• Supported game engines:
• Unity
• Unreal Engine
25
HANDS ON – LITERALLY 
• Requirements:
• Leap motion runtime installed
• Unity project created, Leap .unitypackage imported
• DEMO#1 our goal:
• Let’s build our first leap controller, we want to detect the
position of the tip of one finger and move a cube in a
Unity scene with it.
• Keep in mind:
26
Gestures Recognition
• 4 basic gestures in leap motion, divided in two
types.
• Discrete:
• ScreenTapGesture
• KeyTapGesture
• Continuos:
• CircleGesture
• SwipeGesture
Let’s see a couple examples…
27
Leap Motion Unity Assets
Leap Motion SDK also contain a unity package with a
lot of ready to use stuff we can integrate in our
games without bothering about writing our own
controllers…
• Hand Controllers
• Hand Models
• Grasping utilities
• ....
Let’s make our own little game without writing any leap related
code!
28
Something about the user
experience:
• We should not forget that the emotional part
makes a game/story fascinating
• We are going to create a little game with a very
simple mechanic.
• The player impersonate an assembly line workman
• He should grab bad pieces leaving on the line the
good ones.
• A surveillance camera is active…someone is
watching us…
29
Leap motion and VR
• Leap motion can also be used vertically and
mounted on an Head Mounted Display (HMD) such
as the Oculus Rift
• Orion SDK (now in BETA)
are thought with VR in
mind.
• You can try this
combination for your
final project in the lab!
https://www.youtube.com/watch?v=rnlCGw-0R8g
30
Future of leap motion
• Interaction engine
• http://blog.leapmotion.com/introducing-interaction-engine-early-access-beta/
• Android VR, embedding the
leap motion in visors
• https://developer.leapmotion.com/android#10
7
31
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertising