# Using custom Camera class in SceneKit

**URL:** <https://forums.kodeco.com/t/using-custom-camera-class-in-scenekit/59071>\
**Category:** 3D iOS Games by Tutorials\
**Created:** [January 6, 2019, 3:06am UTC](https://forums.kodeco.com/t/using-custom-camera-class-in-scenekit/59071 "2019-01-06T03:06:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![michielkramer](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/michielkramer/32/79496_2.png) [@michielkramer](https://forums.kodeco.com/u/michielkramer)\
**Post date:** [January 6, 2019, 3:06am UTC](https://forums.kodeco.com/t/using-custom-camera-class-in-scenekit/59071/1 "2019-01-06T03:06:09Z")

</div>

Hey,

I am stuck on something and could use some help…  
I have created a custom Camera class, I would like to add this class to my ViewController so I can load the same camera for all my levels.

I define the class as follows:

class GameCamera: SCNCamera {

```
let cameraNode: SCNNode!

override init() {
    cameraNode = SCNScene(named: "/GameAssets.scnassets/Camera.scn")?.rootNode.childNode(withName: "GameCamera", recursively: true)
    
    super.init()
}

func setup(scnView: SCNView) {
    scnView.scene?.rootNode.addChildNode(cameraNode)
    cameraNode.position = SCNVector3(x: 0, y: 0, z: 0)
    
}

```

}

In the ViewController I then declare a variable and initialise with the class

private var camera = GameCamera()

And i then set up the camera…

camera.setup(scnView: self.scnView)

The camera seems to load, but I can’t seem to view through it. So the class is there but maybe the actual camera object is not loaded??

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [January 9, 2019, 10:16pm UTC](https://forums.kodeco.com/t/using-custom-camera-class-in-scenekit/59071/2 "2019-01-09T22:16:22Z")

</div>

@chrislanguage Can you please help with this when you get a chance? Thank you - much appreciated! :]

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [June 21, 2019, 7:06pm UTC](https://forums.kodeco.com/t/using-custom-camera-class-in-scenekit/59071/3 "2019-06-21T19:06:11Z")

</div>

Closed on June 21, 2019, 7:06pm UTC

This topic was automatically closed after 166 days. New replies are no longer allowed.
