I’ve had this idea for a while for an FPS-esk game where the player is in a zero-g environment and therefor has full range of their camera. As in, from the player’s perspective, there is no “down” and so the camera can be rotated in any direction without limits. Something like in “Space Engine” or “Fractal Block World”.
I’ve actually been trying to figure out how to do this for a few months now, but I still don’t know how to make it work. The main problem is that all of the resources and tutorials in godot for first-person movement have the game have gravity, obviously. That means that the player can’t keep looking down until they are inverted, for example. Then there is the fact that if the player is looking up or down, they will still move forward relative to the ground and not, say, move into the floor or ceiling.
While I have gotten normal first-person movement down (I have been following the tutorials after all!!) turning that into my idea of a free-floating character has been something I haven’t figured out. I run into issues where the character doesn’t move up or down when the camera is pointing up or down, strange rotational bugs, inverted controls, etc…
I know what I am trying to make IS possible, because many games and 3D programs have at least the camera part down, but I just can’t figure out how to do it myself!
Currently my code for player movement is as follows:
var input_vertical = Input.get_axis("movedownward","moveupward")
# go where we are facing
var direction = (self.transform.basis * Vector3(input_plane.x,input_vertical,input_plane.y)).normalized()
var vertdirection = (self.transform.basis * Vector3(0,input_vertical,0)).normalized()
# move
if direction:
velocity.x += direction.x * PLAYERVEL * playervelmultiplyer * 0.01
velocity.z += direction.z * PLAYERVEL * playervelmultiplyer * 0.01
velocity.y += direction.y * PLAYERVEL * playervelmultiplyer * 0.01
else: # slow to stop if no inputs
velocity.x -= lerp(velocity.x, direction.x * PLAYERVEL * playervelmultiplyer, delta) * 0.001
velocity.z -= lerp(velocity.z, direction.z * PLAYERVEL * playervelmultiplyer, delta) * 0.001
velocity.y -= lerp(velocity.y, direction.y * PLAYERVEL * playervelmultiplyer, delta) * 0.001
But as mentioned previously this doesn’t work without bugging out, so there likely needs to be a complete overhaul rather then editing what I already coded in.