Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Steamvr Unity grab object behind camera like fantastic contraption?

Discussion in 'AR/VR (XR) Discussion' started by CoolCrafter584, Mar 26, 2017.

  1. CoolCrafter584

    CoolCrafter584

    Joined:
    Mar 26, 2017
    Posts:
    2
    I'm new in the Vr world with Unity and I want to make my first little game. My problem is that i want to grab an object from my back, like in the game: fantastic contraption, but I don't know how. Thanks for your help. P.S sorry for my english, im german.
     
  2. RadialGames

    RadialGames

    Joined:
    Jan 31, 2017
    Posts:
    11
    Sprechts Deutsch?! Meine name ist Andy, ich wohne in der nähe von Los Angeles, USA!!! (I also studied german for exactly 6 months in high-school). Hallo! Ich bin ein "developer" (auf englisch) of Fantastic Contraption!

    Okay, so here's what we did to pull off shortcuts;

    First, note that there is no hip/leg tracking in FC. That means we need to extrapolate all of our shortcuts (eg: behind the back) from head position.

    There is a gameobject that is tracked with the HMD. In recent unity versions that can be as simple as the Main Camera - the camera moves around and translates/rotates with the HMD position, right?

    Okay, to that game object, we should add some child objects. in our case we use some simple cube colliders ---

    we have a cube collider "under the chin" (spawns light balls)
    we have a cube collider "in the ears" (spawns stickyball or unpowered wheel)
    we have a cube collider "as a hat" (spawns a regular wheel)
    we have a cube collider "over the left shoulder" (spawns a water rod); or right shoulder (spawns a wood rod).

    note that if you tilt your head in a crazy direction, "over your shoulder" is entirely relative to your head. It could be up in the air, or ... this is a fun trick... if you tilt your head backwards a bit, those colliders will actually end up right where your breast is, and you can pluck sticks and rods off of your nipples. (unintended feature)

    We accomplish this spawning by simply making all of the above colliders listed as "isTrigger", and we use a script to track what colliders the hands are currently intersecting. We maintain a list of objects OnTriggerEnter and OnTriggerExit.

    So, when the player presses the trigger, we know where the hand is (which collider is it intersecting with, if any?) and we engage in the behaviour indicated by the flesh bag.

    Ich habst klein geld, machen sie kasekuchen?

    Andy

    ps: feel free to reach out for more info, andy@radialgames.com
     
  3. CoolCrafter584

    CoolCrafter584

    Joined:
    Mar 26, 2017
    Posts:
    2
    @RadialGames Thank you very much for your reply, maybe it helps me out :D. Im really exited to try it and I'll give you updates of my project. But now I have another problem: I modeled some FBX 3D objects with a texture and imported it in Unity. At this point everything is fine(texture is loaded etc. ). But i can't grab or move my object (with scripts from VRTK, I don't know if it is good or not). But I can grab any other (configured) object with both (configured) controllers. Maybe you can help me out of this situation? Thanks again and greets from Austria.