Flying
Flying

Reputation: 169

Collada file not show clear in scenekit

  1. i have imported my collada file of a 3d tunnel in xcode.

2.when i run my sample project it shows 3d tunnel very far and small

class GameViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()

    // create a new scene
    let scene = SCNScene(named: "art.scnassets/tube.dae")!

    // create and add a camera to the scene
    let cameraNode = SCNNode()
    cameraNode.camera = SCNCamera()
    scene.rootNode.addChildNode(cameraNode)

    // place the camera
    cameraNode.position = SCNVector3(x: 0, y: 0, z: 15)

    // create and add a light to the scene
    let lightNode = SCNNode()
    lightNode.light = SCNLight()
    lightNode.light!.type = SCNLightTypeOmni
    lightNode.position = SCNVector3(x: 0, y: 10, z: 10)
    scene.rootNode.addChildNode(lightNode)
  1. i just import my collada 3d object in xcode default ship code what should i do to see my 3d tunnel near to the scene as in following pics in Blender:

3d tunnel in blender

  1. when i run SceneKit project the tunnel in simulator looks like this:

[3d tunnel in scenekit2

5.How can i get my 3d tunnel same view in scenekit as it is in blender.

Upvotes: 0

Views: 307

Answers (1)

Hal Mueller
Hal Mueller

Reputation: 7646

Does your Collada file already have a camera in it, i.e. the one you're using to produce the first rendering?

If so, locate that camera/node (childNodeWithName). Assign it as your view's point of view. Don't create a new camera in your code.

Or, if you really need to create a new camera, put it at the same location as the point of view used for the first rendering.

Upvotes: 1

Related Questions