playMaker

Author Topic: Move in the direction of where you are looking  (Read 107 times)

wuannetraam

  • Playmaker Newbie
  • *
  • Posts: 1
    • View Profile
Move in the direction of where you are looking
« on: March 23, 2020, 09:24:56 AM »
I think this should be something really simple but I can't get it to work.

I have my CameraRig prefab (the standard Steam VR prefab). I have my Vive controllers set up. The X position and the Y position of the touchad are stored as floats. Now I can get my character to move with Velocity and with the stored X and Y variables however the character then only moves back and forth and left to right. I would like it to move in the direction where the player is looking at. I just can't seem to find out how it works.

Hope you have a solution for me.
Thanks!

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 169
    • View Profile
Re: Move in the direction of where you are looking
« Reply #1 on: March 23, 2020, 10:54:54 AM »
You'll need to retrieve the transform direction of the GameObject you want to use for your heading, either your left/right controller or the hmd.

I've attached a small unitypackage with three basic setups to get you started, I also added a custom SteamVR Vector2 action but you can just swap this out for the one you're already using.

If you want to use the hmd for the direction you'll need to change some things yourself. Right now it's only setup to use the input controller for that.

I didn't have time to test this package but it should work. Let me know if you run into any problems.
« Last Edit: March 23, 2020, 10:58:57 AM by LordHorusNL »