3D Perspective должны блокировать полки и т.д. правильноScnview узлы появляются полупрозрачные
Пример изображения из ScnView:
Очень просто. Добавлен Scnview. Добавлены Scnnodes (формы и огни)
Использование стандартного света типа Omni.
Почему объекты впереди не блокируют объекты позади?
Вот код:
[self.studioView addSubview:showTimeView];
showTimeView.frame = CGRectMake(self.paperView.frame.origin.x,
self.paperView.frame.origin.y,
self.paperView.frame.size.width,
self.paperView.frame.size.height);
SCNView *sceneView = (SCNView *)showTimeView;
sceneView.backgroundColor = [UIColor whiteColor];
sceneView.scene = [SCNScene scene];
SCNNode *root = sceneView.scene.rootNode;
sceneView.allowsCameraControl = YES;
sceneView.autoenablesDefaultLighting = NO;
// Add Camera
SCNNode *cameraNode = [SCNNode node];
cameraNode.camera = [SCNCamera camera];
cameraNode.position = SCNVector3Make(0, 0, 100);
cameraNode.eulerAngles = SCNVector3Make(0, -M_PI/8, 0);
cameraNode.camera.zNear = 0;
cameraNode.camera.zFar = thisModuleDepth;
cameraNode.camera.xFov = thisWallWidth;
cameraNode.camera.yFov = thisModuleHeight;
[root addChildNode:cameraNode];
// Add Cabinet Piece
SCNBox *cubeGeom = [SCNBox boxWithWidth:tW
height:tH
length:tD
chamferRadius:0.0];
SCNNode *cubeNode = [SCNNode nodeWithGeometry:cubeGeom];
cubeNode.position = SCNVector3Make(tX, tY, tZ);
// Tag Material
SCNMaterial *material = [SCNMaterial material];
material.diffuse.contents = [UIImage imageNamed:thisColor];
[material.diffuse.contents setAccessibilityIdentifier:thisColor] ;
[material.diffuse.contents setAccessibilityLabel:thisID] ;
cubeNode.geometry.firstMaterial = material;
cubeNode.geometry.firstMaterial.locksAmbientWithDiffuse = NO;
cubeNode.physicsBody = [SCNPhysicsBody staticBody];
[root addChildNode:cubeNode];
// Add spotlight
SCNLight *spotLight = [SCNLight light];
spotLight.type = SCNLightTypeOmni;
spotLight.color = [UIColor whiteColor];
SCNNode *spotLightNode = [SCNNode node];
spotLightNode.light = spotLight;
spotLightNode.position = SCNVector3Make(thisWallWidth/2 ,thisModuleHeight, thisModuleDepth *2);
spotLightNode.light.intensity = 1000;
[root addChildNode:spotLightNode];
Вы создание SCNView в Interface Builder или с кодом? Если последнее, пожалуйста, укажите это. Похоже, что у вашей сцены отключено тестирование глубины, но я не думаю, что это значение по умолчанию. –
Все сделано с кодом ... Я только добавил IBOutlet SCNView * showTimeView для Interface Builder, чтобы подобрать правильный вид ... – Juanra