Adding up/down movement to the FreeCamera

It would be great if you could assign up/down keys to the FreeCamera. Meaning that the camera would go up and down.

I created a pull request for this, but it was rejected. What do I have to change do to get it approved?

I have removed the forward/up naming, maybe this version will have a higher chance of being approved.

Looking at the commits I think there is some confusion here. In the code keysLeft, keysRight, keysUp and keysDown were probably originally named after the specific keys on the keyboard, ie the left, right, up and down arrows, not the direction the camera moves. So we do have keysUp are those moving the camera forward, in the z direction, keysDown are those moving the camera backwards, in the -z direction. What I think @PetterG wants to add are an arrays of keys that move the camera in the y and -y direction. So perhaps a better system might have been keysForward, (z) keysBackward, (-z) keysLeft, (-x) keysRight, (x) keyUp (y) and keysDown (-y) however for backward compatibility this renaming is not possible.

Any more thoughts on this?

Hi Petter,

1st - Thanks for the PR, we always appreciate participation from the wonderful community.

4.1 release is right around the corner. We are in code freeze and apart from bug fixes, no new code is being merged.
I do understand what you were trying to achieve - movement in all 3 Axis - left-right in X, up-down (keyboard up-down) in Z and another keyset for the Y axis. It is just the wrong time right now.

Damn, I really needed this feature. It’s quite a pain to rewrite this in the client side. Especially with typescript. Now I have to wait for like a year for BabylonJS 4.2.

Our preview versions are stable. The only difference is that new API introduced in 4.2 might change until 4.2 will be final.

I always use preview versions when developing.

Shouldn’t be hard to implement, actually. Especially since it is using the _localDirection variable of the camera (which is public but hidden)

Not hard, but messier.

Well I would also argue that dumping a PR without discussing about it was not a good idea. Furthermore when you criticize the API :wink:

There was a reason behind the naming (explained by @JohnK on your PR: Removed improved naming · Pheater/Babylon.js@b4fce9a · GitHub)

That being said I could be ok to merge your PR as I do not think it will hurt the release (and I do need to publish a RC4 anyway).

Can we name them keysYUp and keysYDown maybe?

Another issue with keys for +Y and -Y, what are the natural default keys? The up arrow key and down arrow key lie naturally in the horizontal plane of the keyboard and indicate movement in the +Z and -Z directions, similarly for the left and right arrow keys.

Possible candidates could be < and > as they do appear to give some indication of direction???

Or pageup page down?

They seem suitable.

1 Like

So is this happening?

This is an indication for you to go ahead with submitting a PR, taking into account advice from @Deltakosh on naming and default keys. Use a link to above post when submitting.

1 Like