SceneKit (OpenGL) 内でカメラをスムーズに動かすための標準的な方法は何ですか? 手動で x、y を変更してもスムーズではありませんが、CoreAnimation を使用すると「パルス状」の動きが作成されます。SceneKit のドキュメントは非常に限られているように見えるので、例を挙げていただければ幸いです。私は現在これを行っています:
- (void)keyDown:(NSEvent *)theEvent {
int key = [theEvent keyCode];
int x = cameraNode.position.x;
int y = cameraNode.position.y;
int z = cameraNode.position.z;
int speed = 4;
if (key==123) {//left
x-=speed;
} else if (key==124) {//right
x+=speed;
} else if (key==125) {//down
y-=speed;
} else if (key==126) {//up
y+=speed;
}
//move the camera
[SCNTransaction begin];
[SCNTransaction setAnimationDuration: 1.0];
// Change properties
cameraNode.position = SCNVector3Make(x, y, z);
[SCNTransaction commit];
}