Hi all,
I have searched for help on this matter but haven't had much luck. I am brand new to Scene Kit (and to Cocoa in general) and I'm starting out by trying to make a Minecraft-like voxel engine. This is purely for the learning experience.
In Minecraft, the mouse cursor is locked to the center of the screen. Moving the mouse doesn't actually move the cursor, but rotates the player and camera according to the mouse movement.
This is what I want to do as well, but I am struggling in figuring out how to detect mouse movements (with a locked mouse in the center) in a way that could allow camera/player rotation. Essentially, I want mouse movements to rotate the player horizontally (and the camera, being a child of the player node, should rotate with it). But vertically, only the camera rotates and not the player.
I feel tracking areas are not the answer, since the cursor doesn't actually move. Would I implement a mouseMoved event (assuming it gets called even with a locked cursor), and detect the difference in mouse positions? With that, I could create a direction vector and use that for rotation.
I have heard that using the mouseMoved handling isn't the most efficient approach and am wondering if there's a better way to do this.
Thanks,
Jason