unity and augmented reality · hololens 2d overlays 3d overlays •3d game engine •renders 3d...

20
UNITY AND AUGMENTED REALITY

Upload: others

Post on 09-Nov-2020

26 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

UNITY AND AUGMENTED REALITY

Page 2: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

Oculus Rift (not AR)

Examples

AUGMENTED REALITY

Hololens

2D overlays

3D overlays

Page 3: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

• 3D Game Engine

• Renders 3D graphics, particle effects, animations

• Built in physics engine

• Can export to Android, iOS, OS X, Windows, etc.

Page 4: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

• Unity asset package for AR

• Uses physical tracking targets to position virtual objects

• Targets can be pre-determined or user-defined

• Uses image “features” for recognition

Frame Marker

Image Target

Smart Terrain

User-Defined Targets

VuMarks

Page 5: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

Demohttps://youtu.be/g9U9WKgqPLQ

Page 6: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to
Page 7: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

TUTORIAL 1Configuring Unity and Vuforia

9:35 AM

Page 8: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

SCRIPTS

• Unity Scripts can be written in C# or JavaScript

• Scripts are attached to GameObjects(things in the scene)

• Each script has a Start function (called once) and an Update function (called every frame)

Page 9: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

TRANSFORM

• GameObjects can be translated, rotated and scaled using gameObject.transform

• Movement can be relative to screen or parent object

• Movement can be combined with Time.deltaTime for smooth movement

Page 10: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

TUTORIAL 2Moving GameObjects

9:35 AM

Page 11: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

SCRIPT PARAMETERS

• Scripts can have options which show up in Unity’s inspector pane. Simply make a public variable

• References to GameObjects and other scripts can also be passed by dragging that object to the field in the inspector

• We can then call functions inside the other script

Page 12: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

TUTORIAL 3Calling scripts from other scripts

9:35 AM

Page 13: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

OBJECT HIERARCHY

• GameObjects move with parent objects

• A GameObject can change its parent with:

gameObject.transform.parent=[newparent].transform

• ImageTargets automatically move, show, and hide their children when a target is detected

Page 14: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

OBJECT HIERARCHY

• GameObjects move with parent objects

• A GameObject can change its parent with:

gameObject.transform.parent=[newparent].transform

• ImageTargets automatically move, show, and hide their children when a target is detected

Page 15: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

OBJECT HIERARCHY

• GameObjects move with parent objects

• A GameObject can change its parent with:

gameObject.transform.parent=[newparent].transform

• ImageTargets automatically move, show, and hide their children when a target is detected

Page 16: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

OBJECT HIERARCHY

• GameObjects move with parent objects

• A GameObject can change its parent with:

gameObject.transform.parent=[newparent].transform

• ImageTargets automatically move, show, and hide their children when a target is detected

Page 17: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

TUTORIAL 4Anchoring to the camera

9:35 AM

Page 18: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

PREFABS

• Prefabs are collections of GameObjects, scripts, and other parts which are grouped together as one unit for reuse

• Modifying one instance of a prefab can be used to change all the others

Page 19: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

TUTORIAL 5Saving Prefabs

9:35 AM

Page 20: UNITY AND AUGMENTED REALITY · Hololens 2D overlays 3D overlays •3D Game Engine •Renders 3D graphics, particle effects, animations •Built in physics engine •Can export to

OTHER RESOURCES

• Just Google it!

• docs.unity3d.com/ScriptReference/

• developer.vuforia.com/support