如何在ARKit和SceneKit中正确缩放DAE模型? [英] How to scale DAE models correctly in ARKit and SceneKit?

查看:120
本文介绍了如何在ARKit和SceneKit中正确缩放DAE模型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试合并以下来源:

I'm currently trying to combine the following sources:

Apple SceneKit车辆演示分别.它的Swift版本, ARKit示例,和每个项目的工作都像一个魅力(尽管我更改了车辆演示,以便可以通过屏幕上的按钮控制汽车).

Each project on its own works like a charm (although I changed the vehicle demo so that the car can be controlled by on-screen buttons).

现在,当我尝试将两个项目结合在一起以创建增强现实赛车游戏时,我遇到了有关汽车.dae模型尺寸的问题:它太大了.

Now, when I try to combine both projects to create an augmented reality racing game, I run into problems regarding the size of the .dae model of the car: it's too big.

我可以使用(底盘)节点的 .scale 属性缩放模型,但是一旦添加 SCNPhysicsVehicle 属性和行为,汽车就会重置(?)到其原始大小.我试图在Xcode中缩放模型(打开dae文件,更改比例),但是其边界框保持不变-告诉我重新缩放无法正常进行.

I can scale the model using the (chassis) nodes .scale property, but as soon as I add the SCNPhysicsVehicle properties and behaviour, the car gets reset(?) to its original size. I tried to scale the model in Xcode (open dae file, change scale), but its bounding box remains the same - that tells me that the rescaling didn't work properly.

有任何提示吗?

推荐答案

1),您可以直接通过art.scnassets缩放dae模型.

1)you can scale the dae models by art.scnassets directly.

art.scnassets->car.dae->节点检查器->转换->缩放对象

2)可以通过 SCNAction

let scene = SCNScene(named: "art.scnassets/cup.dae")!
let node = scene.rootNode.childNode(withName: "cup", recursively: true)!
let action = SCNAction.scale(by: sender.scale, duration: 1.0)
node.runAction(action)

这篇关于如何在ARKit和SceneKit中正确缩放DAE模型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆