Hi, i am working on a game where you can rotate the camera around using some keys and control a small ball as a player, but i wish to have the forward arrow key that controls the ball to always move the ball the way the camera is facing, and same for left/right arrow keys. i know where the right and left sides of the ball are, and the front and back, and i wish to add velocity to the ball in those directions, since they change with the camera rotating. how do i do this?
Sorry for the bad Grammar.
You can see my treatment of using a camera to drive movement in my proximity_buttons package.
Look for the DemoCameraRotatedControls
scene.
proximity_buttons is presently hosted at these locations:
https://bitbucket.org/kurtdekker/proximity_buttons
https://github.com/kurtdekker/proximity_buttons
The takeaway is to use the transform.eulerAngles.y of the camera to make a pure-around-Y-axis rotation to change your forward direction to a local one.