Search Unity

Changing the htc vive controller model with a custom hand model

Discussion in 'AR/VR (XR) Discussion' started by Deleted User, Mar 31, 2016.

  1. Deleted User

    Deleted User

    Guest

    Hello guys. I was wondering if anybody knows how to replace the HTC Vive controller model with a custom model (e.g. hand model) in Unity. A help would be much appreciated.

    Thanks in advance.
     
  2. taichiu727magnus

    taichiu727magnus

    Joined:
    Sep 16, 2013
    Posts:
    144
    just need to delete the controller model inside the controller game object and add in your hand model under the controller game object
     
  3. Deleted User

    Deleted User

    Guest

    Thx for the reply but where is the controller model located exactly in the controller game object as I cannot see any physical model inside?
     
  4. taichiu727magnus

    taichiu727magnus

    Joined:
    Sep 16, 2013
    Posts:
    144
    check out the scene in the example folder. u can store a prefab of the vive game object, controllers gameobjects should be included
     
  5. Deleted User

    Deleted User

    Guest

    I know where the controller prefab is, the problem is I do not know how to replace the hand model with the controller image, see it in the scene and interact with objects. I would appreciate any help I can get. Thanks.
     
  6. dariony

    dariony

    Joined:
    May 16, 2015
    Posts:
    19
    Basically (as a reference model) you can find the controller model in the Steam client subfolder:
    Steam/steamapps/common/SteamVR/resources/rendermodels/vr_controller_vive_1_5/
    (on a Mac: home folder/Library/Application Support/Steam/...)

    You can then drop the obj into the Controller (left) / Model object (rotate it 180 and disable the render script to avoid rendering it twice) and now you can see it in the editor (without having to connect to a Vive).

    For additional info see this blog:
    https://medium.com/@dariony/room-scale-vr-using-unity3d-da39919d1063
     
    ViktorKom likes this.
  7. cadpeople

    cadpeople

    Joined:
    Nov 6, 2014
    Posts:
    21
    The problem with this solution is you loose all the button and touchpad interaction :/
     
  8. Deleted User

    Deleted User

    Guest

    Yeah I haven't really figured it out, either. That said, if you need something totally different than the controller itself it's trivial to bring in a skinned mesh renderer with some animations and make an animator / script control it based on your input.

    The pros are definitely preserving the SteamVR API's control over their controller models. I would love to see an example of say, how Fantastic Contraption does it.
     
  9. cadpeople

    cadpeople

    Joined:
    Nov 6, 2014
    Posts:
    21
    Found this thread; this is also how far I've gotten so far: http://steamcommunity.com/app/358720/discussions/0/357287304420388604/
     
    chunk_split likes this.
  10. cadpeople

    cadpeople

    Joined:
    Nov 6, 2014
    Posts:
    21
    Sometimes the most simple solution, is the right one. I rotated the texture 180degrees, then flipped it horizontally. It fits now! SOLVED!
     
    chunk_split and ViktorKom like this.
  11. chunk_split

    chunk_split

    Joined:
    Dec 25, 2017
    Posts:
    7
    Thanks for the link @cadpeople. That script was pretty useful. I ended up making some changes to the original code since I was lazy and wanted to be able to update the textures and see them instantly in the editor. Also, it was slightly out of date (now in 2018) so the event listeners need a minor update.

    Summary of changes:
    1. You don't have to manually flip/rotate the textures. All you have to do is just set the Y tiling in the material to -1.
    2. It allows to to modify the entire material (e.g. if you wanted to add specular highlights).
    3. Modernized this so that it works with the most recent SteamVR_Events model.
    Gist here: https://gist.github.com/patricknelson/2696f245f3b744b7c8a1a26921701191