Search Unity

Avatar hand controlled Steering Wheel

Discussion in 'VR' started by BinoyBalachandran, Jan 23, 2019.

  1. BinoyBalachandran

    BinoyBalachandran

    Joined:
    Jul 4, 2012
    Posts:
    7
    Hi Everybody ,
    I need to develop a avatar hand controlled Car steering wheel .Some one could you help me ?
     
  2. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    302
    rig the avatar in the car interior using a 3d tool. then make an anim track that runs the steering wheel and avatar arms from like -120 deg to +120. Some 3d tools have ik to help keep hands gripping wheel. then in unity you just run anim to desired pos using script. you can also do ik at runtime in unity i think but not sure how, i need to research that. having the anim pre baked in external 3d tool is computationally cheaper tho.
     
  3. BinoyBalachandran

    BinoyBalachandran

    Joined:
    Jul 4, 2012
    Posts:
    7
    Hi SiliconDroid
    Thank you for your valuable thoughts.
    I need this diving experience on the oculus avatar hand controller .I have been done most of the part ,but the problem is still precesting on the physics .Moreover can't rotate an object on x axiz using Hinge joint can you share any idea or inspector value of a Hinge joint
     
    Last edited: Feb 16, 2019
  4. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    302
    i wouldnt use physics in the car interior. i would just use a pre baked avatar animation and scrub that animation around in script. i would do that because i have tight processor budget devving for mobile. if youre devving for pc then you might use physics although maybe problems bevause interior will be within main car collider.

    once you make good anim in 3d tool its easy and cheap to scrub around that anim in script. and perfectly doable in 3d tool as single anim track because that anim is one dimensional, ie wheel angle is main driving variable.
     
  5. BinoyBalachandran

    BinoyBalachandran

    Joined:
    Jul 4, 2012
    Posts:
    7
    Yes its a kind of devving our User ,I need a exact feel of car driving without using a physical steering wheel rather Oculus Touch control .Oculus touch control interact only a Grabable object ,So How to lock Grabable objects Position x,y,z axis
     
  6. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    302
    When user is grabbing wheel you need to make spatial position be closest point on the circle that is the wheel.

    To do this use arc tangent2 function to analyse X and Y spatial components of touch controller position in steering wheels local space, where centre of wheel is X=0, Y=0.

    This gives an angle. Then slerp quickly to point on circle.

    So get the controllers transform and apply InverseTransformPoint to get its position in the wheel transform space.

    Take these wheelspace x,y coords and do Mathf.Atan2(x, y).

    This gives the angle in radians on the wheel closest to controller.

    Then synthesize a "locked" position on the wheel:

    Point on circle:
    X component = circle centre X + sin(angle) * radius
    Y component = circle centre Y + cos(angle) * radius

    For the controllers rotation you could use as is, or perhaps derive a locked angle to keep the displayed controller always tangential to the wheel.

    EDIT: simpler soln: take Vector3 position of controller in wheelspace, zero its z value, normalize it and multiply it by wheel radius. This gives point on wheel in wheelspace.
     
    Last edited: Feb 28, 2019
  7. prashantagent47

    prashantagent47

    Joined:
    Jan 2, 2016
    Posts:
    5
    Hi have you did that correctly,

    I am also trying to do something like that in which using my oculus hand I can grab the steering wheel and can rotate the wheel using my hand anchor position.
    you can also contact me at prashantghatelwal@gmail.com

    thanks in advance please help I am stuck in this with few weeks