我在我的移動應用程序中顯示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