我在我的移动应用程序中显示3D(.obj和.stl)对象。 为了显示3D对象我使用SceneKit Framework.
如何更改SceneKit中3D对象的高度宽度iOS
-(void)spriteKitEx
{
sceneView = [[SCNView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 200)];
sceneView.playing = true ;
sceneView.allowsCameraControl = true ;
scene = [SCNScene sceneNamed:@"realship.obj"];
//Try to change color here using Scenlight
SCNLight *light =[[SCNLight alloc] init];
light.type = SCNLightTypeAmbient;
light.color = [UIColor redColor];
SCNNode *lightNode = [[SCNNode alloc] init];
lightNode.light = light ;
lightNode.scale = SCNVector3Make(1.0, 500.0, 2.0);
[scene.rootNode addChildNode:lightNode];
sceneView.scene = scene;
[sceneView setBackgroundColor: [UIColor redColor]];
[self.view addSubview:sceneView];
}
现在我的要求是根据用户手势来改变3D对象的宽度和高度。
我试图在我的SceneView对象中做到这一点,但无法改变宽度和高度。
任何人都可以帮助我解决这个问题。
我欢迎您的建议和指导。
谢谢先进。
我使用SCNCamera对象,但并没有发现变焦性能u能请给我样品鳕鱼,如果你有 – Tech
不幸的是,虽然SceneKit确实提供了光圈,景深效果的虚拟控制,你必须处理的一个比较传统的领域查看更改缩放:https://developer.apple.com/reference/scenekit/scncamera/1436608-xfov – Confused
如果可以,我会首先将相机进一步/靠近对象。由于这通常会提供更令人愉快的“变焦”体验,因为视场保持不变,但物体距离相机越来越近。 – Confused