【问题标题】:Collada file not show clear in scenekitCollada 文件在 scenekit 中显示不清晰
【发布时间】:2016-08-07 20:47:53
【问题描述】:
  1. 我已在 xcode 中导入了 3d 隧道的 collada 文件。

2.当我运行我的示例项目时,它显示的 3d 隧道非常远且小

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. 我只是在 xcode 默认船舶代码中导入我的 collada 3d 对象我应该怎么做才能看到我的 3d 隧道靠近现场,如下图所示 在搅拌机中:

  1. 当我运行 SceneKit 项目时,模拟器中的隧道如下所示:

[2

5.如何让我的 3d 隧道在场景包中获得与在搅拌机中相同的视图。

【问题讨论】:

    标签: swift blender scenekit


    【解决方案1】:

    您的 Collada 文件中是否已经包含相机,即您用于生成第一个渲染的相机?

    如果是,请找到该相机/节点 (childNodeWithName)。将其指定为您的观点。不要在您的代码中创建新相机。

    或者,如果您确实需要创建一个新相机,请将其放在与第一次渲染使用的视点相同的位置。

    【讨论】:

    • 是的,我有摄像头,但我想用一个新的摄像头,你能建议一个示例代码吗?对不起,我没有得到你推荐的观点......
    • 您的 SceneKit 相机似乎放错了位置。把它和你的 Blender 相机放在同一个地方。
    • 太好了!将答案标记为已接受,而不是“谢谢”评论。
    猜你喜欢
    • 1970-01-01
    • 2019-12-24
    • 1970-01-01
    • 1970-01-01
    • 2015-08-30
    • 1970-01-01
    • 2015-07-13
    • 2015-04-10
    • 2014-10-12
    相关资源
    最近更新 更多