Download

How can I calculate the VR Character Direction for use in an AnimBP Blend Space?

Overview:
I am attempting to setup a VR Character that utilizes the Animation starter pack locomotion animations. In order to drive a blend space in the Anim BP between the different locomotion directions, the blendspace requires a speed and direction value.

Expected output:
The desired input direction value would be:
+90 for Right, -90 for Left, 0 for forward and 180/-180 for backward:

ExpectedValue

Current workflow:
I’m able to get the speed value, and tried following examples from my prior non-VR projects to get the direction but I’m having difficulties getting it right for VR based on the camera rotation.

Here is my current blueprint workflow:

I am getting direction values that dont match with my relative movement direction but rather where my camera is looking, looking towards the positive X axis [ north ] on the level returns 45, looking south returns -135, looking towards the positive Y axis [ East ] returns -45, and looking west returns 135. These values are all irrespective of my actual movement direction.

Let me know your thoughts and possible solutions, I tried multiple rotation nodes with varying levels of failure and have considered possibly rewriting the blendspace direction input but I dont think these are valid solutions.

Thank you for taking the time to read my post :pray:

Hi everyone

I tried various nodes as you can see in the image below, using the “rotation from x vector” node helps get a rotation value but it still does not match the characters/camera root forward direction.

No matter what direction I’m moving, left right, back, forward - it returns a static value based on where the camera is facing.

As mentioned in my initial post “I am getting direction values that dont match with my relative movement direction but rather where my camera is looking, looking towards the positive X axis [ north ] on the level returns 45, looking south returns -135, looking towards the positive Y axis [ East ] returns -45, and looking west returns 135. These values are all irrespective of my actual movement direction.”

Please let me know if anybody has a solution to extracting the VR character direction for the purposes of driving animation BP’s.