lusnaow
lusnaow

Reputation: 51

How to use allowsCameraControl with a camera node in SceneKit

I have a camera node which has been set a projection transform matrix(Not identity) and can see some 3D models with property model view matrix.When I set allowsCameraControl to YES,I can't see any objects if do any gesture.

Firstly,is there any property needs to be set to let allowsCameraControl can be used for user-defined camera node?

Secondly,I have thought just set camera node be the default one and set final model view matrix to SCNMatrix4Mult(modelViewMatrix,projectionTransformMatrix).After doing this,I can see the 3D models,but they seem strange.The ratio of the model does not equal to the screen's.

Any good solution?

Upvotes: 2

Views: 850

Answers (1)

Hal Mueller
Hal Mueller

Reputation: 7646

The allowsCameraControl property is seductive but can be frustrating. I've often seen "nothing", when what was really happening was that my camera was inside the object, or pointed in a direction I didn't expect. Fiddling around and zooming out, or in, for an hour or two often fixed it.

A more controlled way is to put your camera at a known location in your scene. Point it at a particular object (with an `SCNLookAtConstraint'). Set the Z limit to adjust automatically.

Upvotes: 2

Related Questions