How to scale DAE models correctly in ARKit and SceneKit?

Viewed 5542

I'm currently trying to combine the following sources:

Apples SceneKit Vehicle Demo, Resp. its Swift version, ARKit by example, and resp. its Swift version.

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).

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.

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.

Any hints?

3 Answers

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

art.scnassets -> car.dae -> node inspector -> transforms -> scale the object

2) can scale 3dmodel by 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)
Related