"Orienting" a vector3 to the camera

I’m currently working on a custom player controller that uses bodyVelocity to move the character. I’ve managed to figure out how to make the character and camera rotate appropriately with the mouse, and how to translate keyboard inputs to a normalized 8 direction vector. My main issue here is “rotating” that input vector so that the movements are relative to the orientation of the Camera.

I also only want the input vectors to rotate about their Y axis, hence why it is absent from this diagram. The camera should maintain full freedom of movement.

I have tried playing around with the camera’s CFrame but I am rather inexperienced with it. Any help with this would be much appreciated!

Can I see an example of what you have so far in game?

I would recommend

1 Like

Yep, that’s it though for @ChippChirp check out ThanksRobama for a more complete solution with the functions involved.

I did try this exact thing, and yes it for the most part does what I want it to. Only problem is that it also moves along the Y axis. Is there a way to get the same behaviour minus any influence on the Y position?

The solution I linked had a way to over come this. Just set the Y axis to zero by multiplying it to zero.


Thanks much to you and @PapaBreadd! I’ve made the revisions to my code and it works perfectly. Thank you very much for your time.