我在我的 swift 3 项目中设置相机时遇到问题。
这是我的代码
cameraNode = childNode(withName: "cameraNode") as! SKCameraNode
view.scene?.camera = cameraNode
你能帮我弄清楚这里有什么问题吗?即使我在场景编辑器中移动相机,它也不会对我的游戏视图产生任何影响。
非常感谢!
我在我的 swift 3 项目中设置相机时遇到问题。
这是我的代码
cameraNode = childNode(withName: "cameraNode") as! SKCameraNode
view.scene?.camera = cameraNode
你能帮我弄清楚这里有什么问题吗?即使我在场景编辑器中移动相机,它也不会对我的游戏视图产生任何影响。
非常感谢!
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,
Go to the file GameScene.sks
Open the navigation side bar or Navigator (click on the third button from the top right) to open up your assets on the side
Click on, Scene, or the top asset that contains all of these assets
open the side bar on the right or Utilities (click on the first button from the top right)
Click on camera and select the node
If you can't figure this out you are a special type of stupid lol.