0

我在我的 swift 3 项目中设置相机时遇到问题。

这是我的场景

这是我的代码

cameraNode = childNode(withName: "cameraNode") as! SKCameraNode
view.scene?.camera = cameraNode

你能帮我弄清楚这里有什么问题吗?即使我在场景编辑器中移动相机,它也不会对我的游戏视图产生任何影响。

非常感谢!

4

1 回答 1

2

Alright mate, got you fam don't worry. Set a variable the looks something like this,

var GameSceneCamera = SKCameraNode()

Keep your first line of code specifically this,

cameraNode = childNode(withName: "cameraNode") as! SKCameraNode

And delete your second line of code specifically this,

view.scene?.camera = cameraNode

Right, last step mate, this is very important so listen very carefully,

  1. Go to the file GameScene.sks

  2. Open the navigation side bar or Navigator (click on the third button from the top right) to open up your assets on the side

  3. Click on, Scene, or the top asset that contains all of these assets

  4. open the side bar on the right or Utilities (click on the first button from the top right)

  5. Click on camera and select the node

If you can't figure this out you are a special type of stupid lol.

于 2016-12-10T13:28:26.113 回答