Onesun Let Me Do It Again

I finally fabricated my game!

KakaoTalk_Photo_2016-06-24-11-02-12_66 KakaoTalk_Photo_2016-06-24-11-02-11_33

I made my app icon and changed characters. I set my concept about the picture show Toy Story.

When the level goes upwardly, the characters will be added in the game scene.

And I besides changed my cloud that looks like the cloud in Toy Story.

Also, I put the background music of Toy story.

It was a fun work. I like my work very much.

And I'd similar to say thank you to my professor, Todd Holoubek.

This is the code I wrote :

*BadGuy.swift

//

//  BadGuy.swift

//  onesungame_1216212

//

//  Created past 이 원선 on 2016. 5. 10..

//  Copyright © 2016년 이 원선. All rights reserved.

//

import Foundation

//import the spritekit library

import SpriteKit

grade BadGuy {

//create a variable for the bad guys speed

//i tin change this

var speed: Float = 0.0

//define the bad guy as a SKSpritenode

var guy: SKSpriteNode

//create a variable for the current frame

var currentFrame = 0

//create a variable for the random frame

var randomFrame = 0

//create a variable for the state of the bad guys motion

var moving = simulated

//create a variable for the angle of move

//i tin can change this

var angle = 5.0

//create a variable for the range of motility

var range = 10.0

//create a variable for the bad guys Y position

var yPos = CGFloat()

//initialize the bad guy

init(speed:Float, guy:SKSpriteNode) {

self.speed = speed

cocky.guy = guy

cocky.setRandomFrame()

}

func setRandomFrame() {

let range = UInt32(50)..<UInt32(200)

self.randomFrame = Int(range.startIndex + arc4random_uniform(range.endIndex – range.startIndex + 1))

}

//end of class

}

______

*GameScene.swift

//

//  GameScene.swift

//  onesungame_1216212

//

//  Created by 이 원선 on 2016. 5. 3..

//  Copyright (c) 2016년 이 원선. All rights reserved.

//

import SpriteKit

//import library for sound and video

import AVFoundation

class GameScene: SKScene, SKPhysicsContactDelegate {

let background = SKSpriteNode(imageNamed: "BGImage")

//create variable for our audio files

var backgroundMusic : AVAudioPlayer?

var expSnd : AVAudioPlayer?

var countSnd : AVAudioPlayer?

//create a variable for the hero

var hero:Hero!

//create a variable for the users touch location

var touchLocation = CGFloat()

//create an Array to hold the bad guys

var badGuys: [BadGuy] = []

//create a variables for our clouds

let cloud1 = SKSpriteNode(imageNamed: "zloud1")

let cloud2 = SKSpriteNode(imageNamed: "zloud2")

let cloud3 = SKSpriteNode(imageNamed: "zloud1")

//set up a maximum position for the cloud move

var cloudMaxX = CGFloat(0)

//set an original position

var origCloudPositionX = CGFloat(0)

//set the speed for the clouds

//i can change this

var cloudSpeed = ii

//create variables for the ends of the screen

var endOfScreenRight = CGFloat()

var endOfScreenLeft = CGFloat()

//create a variable for the game status

var gameOver = faux

//create a variable for the score

var score = 0

//create a variable for the score characterization

var scoreLabel = SKLabelNode()

//create a variable for the refresh push

var refresh = SKSpriteNode(imageNamed: "1refresh")

//create a variable for the countDown label

var countDownText = SKLabelNode(fontNamed : "helvetica")

//create a timer

var timer = NSTimer()

//create a variable for the inaugural

var countdown = five

//create a variable for the level

var theLevel = 1

//create a variable for the levelLabel

var levelLabel = SKLabelNode(fontNamed : "Courier")

//create a dictionary to hold the clouds statuses

var cloudStatuses:Dictionary<String,CloudStatus> = [:]

//ascertain the collider types for the physics engine

enum ColliderType:UInt32 {

example Hero = ane

case Badguy = 2

}

//gear up up the audio actor

func setupAudioPlayerWithFile(file:NSString, type:NSString) -> AVAudioPlayer? {

//create the path to the sound files

let path = NSBundle.mainBundle().pathForResource(file as Cord, ofType: type as String)

let url = NSURL.fileURLWithPath(path!)

//create a variable for the audio player object

var audioPlayer:AVAudioPlayer?

//error check for the audio player

do {

try audioPlayer = AVAudioPlayer(contentsOfURL: url)

} catch {

impress("thespian not available")

}

//bring the audio player to life

return audioPlayer

}

override func didMoveToView(view: SKView) {

/* Setup your scene here */

//associate the audio variables with their files

if permit backgroundMusic = cocky.setupAudioPlayerWithFile("bgMusic", type: "mp3") {

cocky.backgroundMusic = backgroundMusic

}

if let expSnd = self.setupAudioPlayerWithFile("explosion", blazon: "wav") {

self.expSnd = expSnd

}

if let countSnd = cocky.setupAudioPlayerWithFile("readygo", blazon: "wav") {

cocky.countSnd = countSnd

}

//ready the music book (1.0 =full volume – 0.0 = no volume)

backgroundMusic?.book = 1.0

//loop the bgMusic

backgroundMusic?.numberOfLoops = -i

//play the groundwork music

backgroundMusic?.play()

//set the background color

//self.backgroundColor = SKColor(red: 0.ii, green: 0.v, blueish: 0.8, blastoff: ane)

//self.backgroundColor = SKColor.blueColor()

cocky.background.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame))

self.groundwork.zPosition = -5

//adhere the physics engine to the scene

self.physicsWorld.contactDelegate = self

//assign values to the screen variables

endOfScreenLeft = (self.size.width / two) * CGFloat(-ane)

endOfScreenRight = (self.size.width / two)

//ready the font for the score characterization

//scoreLabel = SKLabelNode(fontNamed: "Helvetica")

//fix the score label position

//scoreLabel.position.y = (self.size.height / 3)

//scoreLabel.position.x = -(self.size.tiptop / three)

scoreLabel.position.y = (cocky.size.height / 3)

scoreLabel.position.10 = (endOfScreenLeft + 600)

//prepare the score label to zero

scoreLabel.text = "0"

//set up the coutdown label to v

countDownText.text = "five"

//set the inaugural characterization position

countDownText.position.y = -(self.size.height / 3)

//hide the inaugural label

countDownText.hidden = true

//assign a name to the refresh push

refresh.name = "1refresh"

//hide the refresh button

refresh.hidden = truthful

//set the levelLabel Y position

levelLabel.position.y = -(self.size.pinnacle / 3) – 50

//set the levelLabel X position

//levelLabel.position.x = -(cocky.size.height / iii) – l

//set the levelLabel text

levelLabel.text = "Level \(theLevel)"

//set the cloud positions

cocky.cloud1.position = CGPointMake(CGRectGetMaxX(self.frame) + self.cloud1.size.width, CGRectGetMaxY(self.frame) – self.cloud1.size.peak + 5)

self.cloud2.position = CGPointMake(CGRectGetMaxX(self.frame) + cocky.cloud2.size.width, CGRectGetMaxY(self.frame) – 200)

cocky.cloud3.position = CGPointMake(CGRectGetMaxX(cocky.frame) + self.cloud3.size.width, CGRectGetMaxY(self.frame) – 150)

//requite the clouds names

self.cloud1.name = "zloud1"

cocky.cloud2.name = "zloud2"

self.cloud3.name = "zloud3"

//add the clouds to the dictionary

cloudStatuses["zloud1"] = CloudStatus(cloudisRunning: false, cloudtimegapForNextRun: cloudRandom(), cloudcurrentInterval: UInt32(0))

cloudStatuses["zloud2"] = CloudStatus(cloudisRunning: false, cloudtimegapForNextRun: cloudRandom(), cloudcurrentInterval: UInt32(0))

cloudStatuses["zloud3"] = CloudStatus(cloudisRunning: false, cloudtimegapForNextRun: cloudRandom(), cloudcurrentInterval: UInt32(0))

//set the original position for the clouds

self.origCloudPositionX = self.cloud1.position.x

//set the maximum position for the clouds

self.cloudMaxX = endOfScreenLeft

//add sprites

//telephone call the part that adds jeff

addmike()

//call the function that adds the bad guys

addBadGuys()

//add together the scorelabel to the view

addChild(scoreLabel)

//add the inaugural label

addChild(countDownText)

//add the refresh push

addChild(refresh)

//add the levelLabel

addChild(levelLabel)

self.addChild(self.background)

//add the clouds

self.addChild(self.cloud1)

self.addChild(cocky.cloud2)

self.addChild(cocky.cloud3)

}

//create a function that causes action when there is contact

func didBeginContact(contact: SKPhysicsContact) {

//terminate the background music

backgroundMusic?.stop()

//play the collision sound

expSnd?.play()

//on collision and the game

gameOver = truthful

//reveal the emitter

hero.emit = true

//reveal the refresh button

refresh.hidden = false

//impress a message to the window

print("OUCH!")

}

//create a random number for the clouds

func cloudRandom() -> UInt32 {

let range = UInt32(x)..<UInt32(1000)

return range.startIndex + arc4random_uniform(range.endIndex – range.startIndex + 1)

}

//use a role to reload the game

func reloadGame(){

//reveal the countdown label

countDownText.hidden = false

countSnd?.play()

//hide the refresh button

refresh.hidden = true

//reset the hero's position

hero.guy.position.x = 0

hero.guy.position.y = 0

//reset the score

score = 0

//reset the score characterization

scoreLabel.text = "0"

//reset the level number

theLevel = 1

//reset the level text

levelLabel.text = "Level\(theLevel)"

//reset the bad guys

for badGuy in badGuys {

//phone call the reset badguys function

resetBadGuy(badGuy.guy, yPos: badGuy.yPos)

//remove all the badguys from the badGuys array

badGuy.guy.removeFromParent()

badGuys.removeAll()

}

addBadGuys()

//start the timer

//timer = NSTimer.scheduledTimerWithTimeInterval(1, invocation: target: self, selctor: #selector(GameScene.updateTimer), userInfo: goose egg, repeats: true)

timer = NSTimer.scheduledTimerWithTimeInterval(ane, target: cocky, selector: #selector(GameScene.updateTimer), userInfo: zilch, repeats: true)

}

//utilize a office to update the timer

func updateTimer() {

if countDown > 0 {

//pause the background music

backgroundMusic?.interruption()

//set up the background music to the beginning

backgroundMusic?.currentTime = 0

//subtract i from the countdown

countDown -= ane

//update the countdown label

countDownText.text = String(countDown)

}else{

//reset the countdown

countdown = 5

//update the inaugural label

countDownText.text = String(countdown)

//hide the timer

countDownText.hidden = true

//reset the gameOver variable

gameOver = false

//deactivate the timer

timer.invalidate()

//beginning the background music over again

backgroundMusic?.play()

}

}

//create a function that adds the hero to the view

func addmike() {

//create a variable for the hero and link it to the asset

let mike = SKSpriteNode(imageNamed: "mike")

//create jeff collision physics

//define the invisible purlieus around the hero

mike.physicsBody = SKPhysicsBody(circleOfRadius: mike.size.width/ii)

//plough off gravitational effects

mike.physicsBody!.affectedByGravity = faux

//define the invisible purlieus

//ready the heroes collider type

mike.physicsBody!.categoryBitMask = ColliderType.Hero.rawValue

//gear up the bad guy as the other type

mike.physicsBody!.contactTestBitMask = ColliderType.Badguy.rawValue

//ascertain the collision area

mike.physicsBody!.collisionBitMask = ColliderType.Badguy.rawValue

//create a variable for the particles

permit heroParticles = SKEmitterNode(fileNamed: "HITParticle.sks")

//hide the particles

heroParticles!.subconscious = true

//create a new hero object

hero = Hero(guy: mike, particles: heroParticles!)

//add the particles to jeff

mike.addChild(heroParticles!)

//add the prototype and object to the view

addChild(mike)

print("At that place's a snake in my chapeau!")

}

//add the bad guys

//i can alter the speed of each bad guy

func addBadGuys() {

addBadGuy("randal", speed: v.five, yPos: CGFloat(cocky.size.tiptop/iv))

addBadGuy("waternoose", speed: 2.0, yPos: CGFloat(0))

addBadGuy("rose", speed: three.0, yPos: CGFloat(-(self.size.acme/4)))

}

func addBadGuy(named: String, speed:Float, yPos: CGFloat) {

let badGuyNode = SKSpriteNode(imageNamed: named)

//create the badguy physics

badGuyNode.physicsBody = SKPhysicsBody(circleOfRadius: badGuyNode.size.width/2)

badGuyNode.physicsBody!.affectedByGravity = false

badGuyNode.physicsBody!.categoryBitMask = ColliderType.Badguy.rawValue

badGuyNode.physicsBody!.contactTestBitMask = ColliderType.Hero.rawValue

badGuyNode.physicsBody!.collisionBitMask = ColliderType.Hero.rawValue

allow badGuy = BadGuy(speed: speed, guy: badGuyNode)

//add together the bad guy to the array

badGuys.suspend(badGuy)

//gear up the bad guys initial position

resetBadGuy(badGuyNode, yPos: yPos)

badGuy.yPos = badGuyNode.position.y

addChild(badGuyNode)

print("Here come the toys!")

}

func resetBadGuy(badGuyNode:SKSpriteNode, yPos:CGFloat){

badGuyNode.position.x = endOfScreenRight

}

//run the clouds

func updateCloudPosition() {

for (cloud, cloudStatus) in cocky.cloudStatuses {

allow thisCloud = cocky.childNodeWithName(deject)

if cloudStatus.shouldRunCloud() {

cloudStatus.cloudtimegapForNextRun = cloudRandom()

cloudStatus.cloudcurrentInterval = 0

cloudStatus.cloudisRunning = true

}

if cloudStatus.cloudisRunning {

//should the cloud exist off the screen?

//if non:

if thisCloud?.position.x > cloudMaxX {

//let it run

thisCloud?.position.x -= CGFloat(self.cloudSpeed)

}else{

//motion the cloud back

thisCloud?.position.x = cocky.origCloudPositionX

//set the condition to non running

cloudStatus.cloudisRunning = false

}

}else{

//increment the time interval

cloudStatus.cloudcurrentInterval += 1

}

}

}

override func touchesBegan(touches: Set<UITouch>, withEvent result: UIEvent?) {

/* Called when a touch begins */

for touch: AnyObject in touches {

if !gameOver {

//where did the user touch the screen

touchLocation = (touch.locationInView(self.view!).y * -ane) + (cocky.size.height/ii)

}else{

permit location = touch.locationInNode(self)

permit sprites = nodesAtPoint(location)

for sprite in sprites {

if permit spriteNode = sprite as? SKSpriteNode {

if spriteNode.name != nil {

reloadGame()

}

}

}

}

}

//declare a variable that defines the motion

let moveAction = SKAction.moveToY(touchLocation, duration: 0.5)

//add a picayune way to the motion

//I tin change this

moveAction.timingMode = SKActionTimingMode.EaseOut

//move the hero

hero.guy.runAction(moveAction)

}

override func update(currentTime: CFTimeInterval) {

/* Called earlier each frame is rendered */

if !gameOver {

updateBadGuysPosition()

updateCloudPosition()

}

updateHeroEmitter()

}

//create a part to manage the emitter particles

func updateHeroEmitter(){

if hero.emit && hero.emitFrameCount < hero.maxEmitFrameCount {

hero.emitFrameCount += 1

hero.particles.subconscious = fake

} else {

hero.emit = false

hero.particles.hidden = truthful

hero.emitFrameCount = 0

}

}

//create a function to movement the bad guys across the screem

func updateBadGuysPosition() {

for badGuy in badGuys {

if !badGuy.moving {

badGuy.currentFrame += 1

if badGuy.currentFrame > badGuy.randomFrame{

badGuy.moving = true

}

}else{

badGuy.guy.position.y = CGFloat(Double(badGuy.guy.position.y) + sin(badGuy.bending) * badGuy.range)

badGuy.bending += hero.speed

//set the position of the bad guy depending on its location

if badGuy.guy.position.ten > endOfScreenLeft {

badGuy.guy.position.ten -= CGFloat(badGuy.speed)

}else{

badGuy.guy.position.ten = endOfScreenRight

badGuy.currentFrame = 0

badGuy.setRandomFrame()

badGuy.moving = false

badGuy.range += 0.ane

updateScore()

}

}

}

}

func updateScore() {

//add together one to the score

score += 1

//update the scoreLabel

scoreLabel.text = String(score)

/*

//if the current score divided by 5 produces a remainer of 0

if (score % 5 == 0){

//increase the level past 1

theLevel += 1

//update the levelLabel

levelLabel.text = "Level \(theLevel)"

//add badguys

//addBadGuys()

}

*/

//if the electric current score divided by 5 produces a remainer of 0

if (score % 5 == 0){

//increase the level by 1

theLevel += 1

//update the levelLabel

levelLabel.text = "Level \(theLevel)"

//add badguys

addBadGuy("rotso", speed: 3.five, yPos: CGFloat(self.size.summit/iv))

}

//if the current score divided by 5 produces a remainer of 0

if (score % 20 == 0){

//increase the level past 1

theLevel += 1

//update the levelLabel

levelLabel.text = "Level \(theLevel)"

//add badguys

addBadGuy("zerg", speed: i.5, yPos: CGFloat(self.size.superlative/4))

}

//if the electric current score divided by 5 produces a remainer of 0

if (score % xl == 0){

//increase the level by i

theLevel += 1

//update the levelLabel

levelLabel.text = "Level \(theLevel)"

//add badguys

addBadGuy("rose", speed: 1.5, yPos: CGFloat(self.size.height/4))

}

//print the score to the message window

print(score)

}

//finish of class

}

____________

*Hero.swift

//

//  Hero.swift

//  onesungame_1216212

//

//  Created by 이 원선 on 2016. 5. 3..

//  Copyright © 2016년 이 원선. All rights reserved.

//

import Foundation

//import spritekit

import SpriteKit

class Hero {

//declare variables for the hero

var guy:SKSpriteNode

//declare a variable for the hero'southward speed

var speed = 0.ane

//declare variables for the emitter

//plough off the emitter

var emit = false

//prepare the initial frame count

var emitFrameCount = 0

//set the maximum frame count

var maxEmitFrameCount = 30

//declare a variable for the particles

var particles:SKEmitterNode

//initialize the spriteNode

init(guy:SKSpriteNode, particles:SKEmitterNode) {

self.guy = guy

self.particles = particles

}

//end of class

}

___________

*CloudStatus.swift

//

//  CloudStatus.swift

//  onesungame_1216212

//

//  Created by 이 원선 on 2016. vi. 20..

//  Copyright © 2016년 이 원선. All rights reserved.

//

import Foundation

class CloudStatus{

//create a variable for the state of the cloud

var cloudisRunning = false

//create a variable for length of time to look for the next run

var cloudtimegapForNextRun = UInt32(0)

//how long take we waited

var cloudcurrentInterval = UInt32(0)

//initialize the cloud

init(cloudisRunning:Bool, cloudtimegapForNextRun:UInt32, cloudcurrentInterval:UInt32) {

self.cloudisRunning = cloudisRunning

self.cloudtimegapForNextRun = cloudtimegapForNextRun

self.cloudcurrentInterval = cloudcurrentInterval

}

//create a function that decides if a cloud should run

func shouldRunCloud() -> Bool {

return cocky.cloudcurrentInterval > self.cloudtimegapForNextRun

}

//end of class

}

Final week, we learned about the advanced part of AR. This time, we will learn how to modify the teapot'south color. Here is the process.

스크린샷 2016-05-30 오전 10.29.39

Showtime, download the file named 'virtualbuttonDL' in course website.

스크린샷 2016-05-30 오전 10.31.02

Make a new project in Unity.

스크린샷 2016-05-30 오전 10.32.40

Next, go to build settings and change its platform into iOS. And click 'Player settings'.

스크린샷 2016-05-30 오전 10.34.05

In player settings, un-check 'portrait' and 'portrait upside downward'. And change company proper noun and product name. My parcel identifier is 'com.onesun.virtualbuttons_class_1216212'.

스크린샷 2016-05-30 오전 10.37.36

And bring Vuforia unity package that nosotros downloaded last fourth dimension.

스크린샷 2016-05-30 오전 10.48.50

Delete the principal camera,

스크린샷 2016-05-30 오전 10.49.41

And drag 'ARCamera' into the scene. Set its position 0:0:0.

스크린샷 2016-05-30 오전 10.52.27

Go to Vuforia homepage and copy the license cardinal that nosotros add last time.

스크린샷 2016-05-30 오전 10.52.40

And paste it in 'App License fundamental' in 'Vuforia Beliefs'.

스크린샷 2016-05-30 오전 10.54.15

Go dorsum to Vuforia homepage and go to target managing director. In here, nosotros will create another database. Write the proper noun you lot want, and select 'Device'. And click 'create'.

Click the database y'all added correct before. And click 'add target'.

스크린샷 2016-06-04 오후 3.47.34.png

Yous will see this pop-up screen when you click it.

Bring 'woodtag.jpg' in the folder that you downloaded in the form website. Select 'unmarried paradigm' and set the width 50.

스크린샷 2016-05-30 오전 10.57.50

Then the target volition appear in the screen. Click 'Download Database'.

스크린샷 2016-05-30 오전 10.58.08

Then this pop-up screen will appear. Select Unity editor in the platform and click download.

스크린샷 2016-05-30 오전 10.59.58

Then the unity parcel volition be downloaded on your computer.

스크린샷 2016-05-30 오전 11.00.05

Import that unity package in Unity.

스크린샷 2016-05-30 오전 11.42.53

Make a new folder named 'model' inside the assets binder, and put all the files that you downloaded in the class website.

스크린샷 2016-05-30 오전 11.55.57

Adjacent, go to UI > Event organisation.

스크린샷 2016-05-30 오전 11.57.23

Elevate 'imagetarget' into the scene. It is in 'prefabs' folder. And set its position 0:0:0.

스크린샷 2016-05-30 오전 11.59.25

In image target behavior, in that location is 'database'. Select information technology that you downloaded correct before.

스크린샷 2016-05-30 오후 12.02.11

Adjacent, In 'ARCamera' inspector, rotate x position 90 degree and prepare y position in 42. Then the tag volition appear well in the game view.

스크린샷 2016-05-30 오후 12.04.03

Adjacent, add 'virtual button result handler' in the image target inspector.

스크린샷 2016-05-30 오후 12.07.05

When y'all write '5' in the teapot material size,

스크린샷 2016-05-30 오후 12.08.07

5 element will announced in at that place.

스크린샷 2016-05-30 오후 12.08.50

Select its material in regular sequence. Information technology must be matched with the picture color's sequence.

스크린샷 2016-05-30 오후 12.13.29

Next, drag the model named 'teapot' into the scene. It must be placed inside the image target. And set its size 0:0:0.

스크린샷 2016-05-30 오후 12.16.48

Next, go to the 'ARCamera' inspector and check 'Load arVbuttons DB Database'. And also check 'activate'.

스크린샷 2016-05-30 오후 12.20.59

Then nosotros tin can encounter the pot within camera. And rotate the image target and so that we can hands meet its buttons.

스크린샷 2016-05-30 오후 12.22.49

Get to Gameobject > create empty.

스크린샷 2016-05-30 오후 12.22.59

And alter its name 'buttons'.

스크린샷 2016-05-30 오후 12.23.33

In assets > vuforia > prefabs, there is a VirtualButton. Drag information technology into the 'buttons' in Hierarchy.

스크린샷 2016-05-30 오후 12.27.02

Drag 'push button' folder into the image target. 'Button' folder volition be a kid of paradigm target. And fix the position and size that fits with the first push.

스크린샷 2016-05-30 오후 12.29.26

Adjacent, add 'virtual button behavior' in the inspector.

스크린샷 2016-05-30 오후 12.35.25

Make 4 more buttons and pull out in the image target. You tin't motion it when you don't pull out in it.

스크린샷 2016-05-30 오후 12.37.11

Set its positions that fits in its buttons. If yous washed with setting its position and size,  drag information technology into image target again.

스크린샷 2016-05-30 오후 12.39.39

Select push button and change its name same with the color. Set up the name of another 4 buttons as well.

스크린샷 2016-05-30 오후 12.45.19

Then the pot will appear and too change its color when you lot click play button. Neat!

Final time, we started learning near Augmented Reality. Augmented reality, also known every bit AR, is a type of virtual reality that aims to duplicate the world's environment in a figurer or mobile phone. Today, AR is used in amusement, war machine training, design, robotics,  manufacturing and other industries.

In class, Professor Todd told us nigh a website named 'Vuforia'. Vuforia is an Augmented Reality Software Development Kit (SDK) for mobile devices that enables the cosmos of AR applications. They provides SDK to build applications for mobile devices. It also can be built with Unity. Allow'southward brand a uncomplicated project using Vuforia SDK in Unity.

스크린샷 2016-05-16 오전 10.47.06

Start, go to Vuforia website (Vuforia.com). Y'all must annals to download the file. Later annals, log in and get to 'downloads'. We have to download the file which can be used in Unity, so download the file named 'Download for Unity'.

스크린샷 2016-05-16 오전 10.51.32

And you tin can get this image by typinghttps://db.tt/mXvO4uLj in website address bar.

스크린샷 2016-05-16 오전 10.56.31

Become to Unity and create a new file.

스크린샷 2016-05-16 오전 10.58.16

Go to File > Build Settings.

스크린샷 2016-05-16 오전 10.58.26

In Build settings, select iOS in platform and click 'Switch Platform'.

스크린샷 2016-05-16 오전 10.59.06

Next, go to Import Package > Custom Package.

스크린샷 2016-05-16 오전 10.59.43

Select unity bundle file that we downloaded in Vuforia.

스크린샷 2016-05-16 오전 11.01.21

Then you lot tin can see this screen and assets.

스크린샷 2016-05-16 오전 11.01.58

Let'south download 3d model in Asset store. I chose 'Cute Kitten'.

스크린샷 2016-05-16 오전 11.16.56

Get to Hierarchy and delete 'Main Photographic camera'.

스크린샷 2016-05-16 오전 11.17.34

You can see a prefab named 'ARCamera' in assets > prefabs. Drag information technology to the scene.

스크린샷 2016-05-16 오전 11.19.06

And set its position in 0:0:0.

스크린샷 2016-05-16 오전 11.20.50

Go to Vuforia website over again. You lot tin can discover License Managing director in 'Develop'. And click 'Add License Fundamental'. Without license primal, your project volition non piece of work.

스크린샷 2016-05-21 오후 8.18.00.png

Write 'arClassDemo' in name field and select 'mobile' in device. And select 'starter – No accuse' in License central. Click Side by side.

스크린샷 2016-05-16 오전 11.23.02

And you lot will see this pop-upward screen. Cheque agreements of terms and condition and click 'confirm'.

스크린샷 2016-05-16 오전 11.23.22And you can see new license primal added.

스크린샷 2016-05-16 오전 11.23.44

In license primal, you can see long, strange code. This code is a license primal.

스크린샷 2016-05-16 오전 11.24.01

Allow'due south copy this code.

스크린샷 2016-05-16 오전 11.24.11

Let'south go to Unity again. Select ARCamera in Hierarchy and go to inspector. In inspector, you can detect 'Vuforia Behavior (Script)'. Within information technology, there is a 'app license central' field. Paste the code that you copied in vuforia homepage.

스크린샷 2016-05-16 오전 11.25.26

Go to Vuforia website again. This time, click 'Target Manager' in Develop section.

스크린샷 2016-05-16 오전 11.25.58

In target manager, click 'Add Database'.

스크린샷 2016-05-16 오전 11.26.17

Write 'arClassDemoDB' in the name field and select device in Blazon. And click Create button.

스크린샷 2016-05-16 오전 11.26.45

Then you tin can meet new database created. Click it.

스크린샷 2016-05-16 오전 11.28.01

In here, click 'add target'.

스크린샷 2016-05-16 오전 11.29.50

So you tin can run into this pop-upwards screen. Bring a rock picture that you downloaded. And set the width 'l'. Click 'add'.

스크린샷 2016-05-16 오전 11.30.05

You can see new target created. five stars rated in 'rocks' picture. Camera tin can recognize this pic more than hands when rating is high. The one with rocks accept high contrast and take many details, so camera can easily recognize information technology. If star rating is row in the picture you added, you should change it into another ane.

Let's download the database nosotros added. Click 'Download Database (All)'.

스크린샷 2016-05-16 오전 11.33.00

You lot must select 'Unity Editor' in platform. And click Download.

스크린샷 2016-05-16 오전 11.35.47

And so this file will be downloaded in your figurer.

스크린샷 2016-05-16 오전 11.36.19

Become to Unity and click Assets > Import Package > Custom Package.

스크린샷 2016-05-16 오전 11.36.33

Import the database unity package file that you downloaded.

스크린샷 2016-05-16 오전 11.38.07

Then you will come across this assets. Select 'Imagetarget' in assets > Vuforia > Prefabs.

스크린샷 2016-05-16 오전 11.38.49

Drag it into the scene and set the position in 0:0:0.

스크린샷 2016-05-16 오전 11.40.27

And select the 3d model that you lot downloaded in the asset store. Also drag it into the scene.

스크린샷 2016-05-16 오전 11.42.11

In bureaucracy, drag 'kitten' into 'ImageTarget'. 'kitten' will become a child of 'Imagetarget'. This is very important.

스크린샷 2016-05-16 오전 11.42.36

And ready the position of kitten 0:0:0.

스크린샷 2016-05-16 오전 11.45.20

Next, select ARCamera in hierarchy and go to inspector. In there, you tin find 'Database Load Behavior (Script)'. Check 'Load arClassDemoDB'. After checking it, 'Activate' will appear. Bank check it, too.

스크린샷 2016-05-16 오전 11.46.55

And select ImageTarget in hierarchy. Go to inspector and detect 'Image Target Beliefs (Script)'. Select 'arClassDemoDB' in type. And select 'rocks' in Database.

스크린샷 2016-05-16 오전 11.47.38

The texture of the plane will change into the picture that y'all downloaded.

스크린샷 2016-05-16 오전 11.50.15

Build it and install information technology into your telephone.

KakaoTalk_Photo_2016-05-21-21-41-28_31

Look! A cute kitten is sitting in my macbook!

This is the end of the process that nosotros learned last class.

스크린샷 2016-05-21 오후 9.44.27

스크린샷 2016-05-21 오후 7.00.09

This time, I put a skull in my AR. I tin't print my database picture show, so I tried it using my iPhone. Cool!

framewarand.blogspot.com

Source: https://onesunnn.wordpress.com/

0 Response to "Onesun Let Me Do It Again"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel