Converting Camera Direction To Velocity - Using Get Camera Direction

Hello,
So I made this playground:

I am using camera.getDirection to get basically a velocity vector to move the player in.
Now, this works kinda all right expect when you are looking down and up.

Is there a way to get the direction and have it only apply to a flat XZ plane?

There might be something I am missing or just something I don’t know.
Any advice would be very helpful.

I’ve been working on developing a better player demo for the voxel engine:

And it is coming along great this is just something that I would like to figure out.

Thank you!

1 Like

You could simply get the direction, set y to 0 and normalize back :slight_smile:

This would work everywhere but looking fully up or down leading to 0

1 Like

Awesome and yep that is the answer:

I got it working in the playground.

Thank you so much!

2 Likes