33
Lecture 6: Music and Sound Eect & GVR Try out. Dr. Kobkrit Viriyayudhakorn iApp Technology Limited [email protected] ITS488 (Digital Content Creation with Unity - Game and VR Programming)

ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Embed Size (px)

Citation preview

Page 1: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Lecture 6: Music and Sound Effect& GVR Try out.

Dr. Kobkrit ViriyayudhakorniApp Technology Limited

[email protected]

ITS488 (Digital Content Creation with Unity - Game and VR Programming)

Page 2: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Starter Project

https://github.com/kobkrit/VR_basketball

Page 3: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Sound Effect

Page 4: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Getting Resource from Unity Asset Store

Page 5: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Audio Kit

Download Audio Kit at http://bit.ly/2iVDB7v

Page 6: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Import Audio Kit

1. Menu Bar > Assets > Import Package > Custom Package...

2. Select the "AudioKit.unitypackage"

3. Make sure that all files are selected, and then

Press "Import"

Page 7: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Imported Audio

Press to Play

Page 8: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Adding Music to the Game

1. Select "Scene 1". Right click at Hierarchy > Audio > Audio Source

2. Drag the "music...come..."to the Audio Source

Page 9: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Configure the Music

1. Select Audio Source

2. Checked at • Play On Awake• Loop

3. Run "Play" to Test.

Page 10: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Exercise 1: Add a sound to Game Over.

• Find the sound that seems most appropriate to you.

• Should it be looping or not?

• Add the audio source to the Game Over scene.

Page 11: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Adding Sound Effect to Ball

1. Open the Scene 2 > ShootHoopKit > Drag the ball to the Hierarchy windows

2. Select the ball at the right inspector windows >Add Component > Audio Source

3. The attached audio sourceis added into the Ball Game object

Page 12: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Trigger Sound Effect by Code

1. Drag a drop Sound file. the impact_deep_thud_bounce sound file into the AudioClip 2. Add the new C# script, "BallBounceSound.cs"

Page 13: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

BallBounceSound.cs

2. Drag the BallBounceSound.cs to attached with the ball game object. >>

1. Writing the above code.

Trigger Sound Effect by Code

Page 14: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Make the customized ball as the prefab

1. Press "Play" now, We will heard only the single drop of sounds.

Even you firing multiple ball.

2. Drag the customized ball as the ball prefab.

3. Press Play again.Now you will heard multiple

drop sounds.

Page 15: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Exercise 2: Adding a scoring sound.

• Add an audio source component.

• Find a good scoring sound.

• Trigger in the appropriate place.

Page 16: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Solution for Exercise 2• Enter the ScoreCount.cs, Add the AudioSource part at IncreaseScore Function.

Page 17: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

1. Select "ScoreCount" Game Object,At the inspector windows, Add "Audio source".

2. Drag and drop "Chime_ball_02" at the AudioClip part.Unchecked "Play On Awake checkbox.

Page 18: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Play with sound time.

Page 19: ITS488 Lecture 6: Music and Sound Effect & GVR Try out
Page 20: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Make our life easier with Google VR SDK

Page 21: ITS488 Lecture 6: Music and Sound Effect & GVR Try out
Page 22: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Google VR Installation• https://developers.google.com/vr/unity/download

Page 23: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Making a new project

Page 24: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Import GVR unity package

1. Assets > Import Package > Custom Package....

2. Select GoogleVRForUnity_1.110.0.unitypackage

3. Make sure that all items are checkedand then "Import"

Page 25: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Google VR Demo

Page 26: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Play around with GVR Demo

1. File > Build Settings...

1. Tap "Add Open Scenes" 2. Select iOS 3. Click "Switch Platform"

Page 27: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Change to Virtual Reality Project

1. Click on "Player Settings"

2. At the XR Settings,Select "Virtual Reality Supported" and Add "Cardboard" to Virtual Reality SDK

Page 28: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Test on iOS

1. Connect with iOS phone to the machine.2. Press "Build and Run"

Page 29: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Fast VR project using GVR

1. Create a New Empty Scene2. Add Cube into the Scene,

Make it in front of the Camera3. Play

You can not move any view.

Page 30: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

1. Go to Google VR Assets > Prefabs

Using GVR Prefab

2. Import the prefab like this...

Page 31: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Now you can move in VR

• Shift + Move Mouse = Change Orientation • Shift + Left Mouse Button = ClickButton • Shift + Right Mouse Button = AppButton • Shift + Middle Mouse Button = HomeButton/Recenter • Shift + Ctrl = IsTouching • Shift + Ctrl + Move Mouse = Change TouchPos

Page 32: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

There is much more in Google VR• A simple reticle prefab and associated scripts for gaze-based user interaction.

• User head tracking.

• Side-by-side stereo rendering.

• Detecting user interaction with the system (via trigger or controller).

• Automatic stereo configuration for a specific VR viewer.

• Distortion correction for a VR viewer's lenses.

• An alignment marker to help center the screen under the lenses when you insert your phone into a viewer.

• Automatic gyro drift correction.

Page 33: ITS488 Lecture 6: Music and Sound Effect & GVR Try out

Q/A