PlayMaker Help & Tips > VR Help

Move in the direction of where you are looking

(1/4) > >>

wuannetraam:
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:
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.

*Edit*

Package updated.

wuannetraam:
thank you very much for your reply! Sorry for the late response. Im going to test out your package!

wuannetraam:


http://cfxsquad.nl/Walking%20In%20Direction%20Example.rar

Thanks for taking the time to create a sample scene. Im not really able to find my way in it. I would like my object to move in the direction of the VR Camera (Head).
I have added a screenshot with my movement setup in Playmaker. I think there is something very simple Im missing. Btw Im not using Character Controller but a Rigid Body.  I've attached a very simple project to this post. Maybe someone wants to take a quick look at it and has a solution?

Best,
Maarten

jeanfabre:
Hi,

 to get the direction of the camera, use TransformDirection action on the local z axis, that will give you the world direction that the player should move to so when you translate your player, you use that as the base.

Does that make sense?

Bye

 Jean

Navigation

[0] Message Index

[#] Next page

Go to full version