Can't figure out how to lock camera vertical motion without locking rotation

Another noob with camera troubles.

I’ve tried just about every suggestion I could Google, and none of them seem to work quite right. I fix one problem only to introduce a worse one.

I want to have a camera attached to a player spatial, and I want the camera to be able to look around in all directions, but only move in a flat plane, i.e., the camera’s Y axis position never changes, even though it looks up or down. Basic FPS camera.

In some other resources I read on the forum, it was suggested that BetterCharacterControl be used instead of CharacterControl. Problem is, the methods are different, and I can’t find an example showing what I want. There’s a BetterCharacterControl test/example, and I’ve looked through it about a dozen times. When the camera is locked to the character node, any vertical camera motion is disabled. It seems that the proper “FPS” camera examples are the HelloTerrain/Collision examples, among others, but they rely on a CharacterControl, and apparently the CharacterControl has physics issues.

I’ve tried many different varieties of nodes on nodes and different camera types. I’ve tried manually changing the camera’s rotations through various methods, but none of them work. I extended Camera and made my own, copying all of the FlyByCamera class and adding a line that stops any vertical motion, which works fine… except when I attach it to a spatial, and there’s no way to move it up to eye height. And to clarify, no, I didn’t remove the rise method, I told the move method to ignore any values from the camera direction vector that would make it go up. The rise method still works fine… until attached to a spatial. And apparently, I can’t set a node to follow above the spatial because I’m an idiot.

Sorry about the rambling. This is frustrating. :stuck_out_tongue: And apparently, it seems that a lot of people struggle with the camera until they eventually write their own.

tl;dr;

Is there some code I can look at that uses BetterCharacterControl and a typical FPS style camera? The only examples I see are for CharacterControl, and the methods are different.

@MixGrey said: Sorry about the rambling. This is frustrating. :P And apparently, it seems that a lot of people struggle with the camera until they eventually write their own.
I doubt that things get better when they write their own camera class. Camera is just that : a camera. It just provides a view on the scene.

FlybyCamera and ChaseCamera are poorly named because they are more camera handlersthat have a certain behavior.
What you want is to make your own handler.
You should start with a CameraNode, and attach it to the player’s node. Then, you can offset the cameraNode position so its height match the character’s head.
Then, have a control on the cameraNode that makes the node rotate with the mouse, or, copy the player’s facing direction.
You’ll have a hard time adapting the flycam to whatever behavior you want. making your own handler will ease things up a lot.

As hinted, FlyByCam is only good for demos because in real games you almost never move the camera but the player. Trying to have the camera move the player or link the player to the camera movement is a bit like make the horse push the cart.

So, yes, you will likely want your own input handling (as described above) to move your game objects. Camera movement then becomes incidental as it is just linked to some game object or data.

Okay, thanks. I’ll try that. I hadn’t messed with the CameraNode, just the cam itself and the appstate.