Player movement with rotated camera

my game works as it is with normal wasd movement via setvelocityx and setvelocityy. i have added camera rotation and would like the player to be able to move in the same directions with the camera rotation in mind. so if the camera is rotated slightly for example, the player would still move left given the camera perspective. just like the game rotmg. how would i go about this? i’ve been messing with velocityfromrotation with no luck

I think you can add

player.body.velocity.rotate(-camera.rotation);

it works perfectly, samme. thank you so incredibly much. you’ve helped me before in the past perfectly and was hoping you’d respond. thank you so much.

1 Like