When using a camera with myCameraNode.camera.usesOrthographicProjection = YES;
, as far as I can tell you can't zoom as you normally would using the default controls given by myScene.allowsCameraControl = YES;
– the only way to zoom that I can tell is by changing myCameraNode.scale = (SCNVector3*)...
Is there a way to somehow bind the scroll wheel to this scale parameter, while retaining the standard camera controls for rotation/translation? Or to otherwise 'fix' the default camera controls?
Edit: I think I'm misunderstanding how the camera works. The two-finger zoom gesture does still work with orthographic projection, but it seems like it only lets me zoom out and not let me zoom in any further. I suspect it may be related to the myCameraNode.scale
, but if I don't set that parameter the objects in my scene are huge and I only see a tiny fraction of it (and the larger the scale
the smaller my objects get).
The built-in camera controls on SCNView
are pretty basic, probably best used only for debugging. For a production app, it's better to control the camera yourself, especially if you're using orthographic projection. Set up your own event handling that controls the orthographicScale
property of the camera, and you're set.
Followup on comment:
The scale
property on SCNNode
controls how big a node's content is relative to its parent node — it's a coordinate space transformation, just like rotation
and position
. It's not really appropriate for implementing camera zoom. In a perspective projection, you use the camera's xFov
and/or yFov
properties to zoom (and I presume that's what the built-in camera controls do). The API doesn't define what the controls do for an orthographic camera, so anything you observe about its behavior is probably undefined and might be a bug... you might not be able to rely on it staying that way.
If there's more you'd like the built-in camera controls to handle, I'd recommend filing an enhancement request.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments