Search Unity

Bicycle VR

Discussion in 'AR/VR (XR) Discussion' started by ganu07, Apr 10, 2017.

  1. ganu07

    ganu07

    Joined:
    Feb 28, 2017
    Posts:
    12
    I am developing a bicycle VR game and i am facing certain problems. I am using Garmins' speed and cadence sensor and a USB ant stick. The problem is when i pedal my bicycle how do i move the character in game. I am not able to figure out any solutions for this.
     
  2. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    302
    Hi,

    What is your problem exactly?

    Are you able to get the speed and cadence signals into unity? If not then I can't be of much help, don't have such a device.

    Do you know how to move a character (regardless of garmin USB device), i.e. do you know how to move a model around using plain joystick inputs?
     
  3. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    wheel radius or diameter gives you the perimeter and the speed. You can get the speed velocity value. After that you put it into a float. Then just move the game object [your character] using transform.position (Z forwards). Look into the C# learning sections.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class ExampleClass : MonoBehaviour {
    5.     public float speed;
    6.  
    7.     void Update () {
    8.         transform.position = new Vector3(0, 0, speed* Time.deltaTime);
    9.     }
    10. }
    the code is a draft example that was not tested.
     
    Last edited: Apr 12, 2017
  4. ganu07

    ganu07

    Joined:
    Feb 28, 2017
    Posts:
    12
    Hey, The problem is I am using Garmin's Speed and cadence sensors and a Ant+ USB stick.
    1) I am not able to get the values of those sensors into unity.
    2) When i pedal the bicycle in the real world i need my object in the game to move too...like if i pedal fast the object should move fast...if i pedal slow the object should move slow
     
  5. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    302
    Lucky for you there is an opensource C# library to read ANT devices over USB.
    You could take the windows DLL and use its functionality via c# script:

    https://github.com/missyb/ANT_Project

    The project depends on C#3.5+ so a chance it could also be built for multiple platforms with minimal pain.

    NOTE: Also looks like you need to apply to be a developer for ANT in order to get "The ANT+ Network Key". You'll have to write to ANT authority and pitch your idea first.
     
  6. ganu07

    ganu07

    Joined:
    Feb 28, 2017
    Posts:
    12
    Thank You SiliconDroid:)
     
  7. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    302
  8. ganu07

    ganu07

    Joined:
    Feb 28, 2017
    Posts:
    12
    thank you:)
     
  9. ganu07

    ganu07

    Joined:
    Feb 28, 2017
    Posts:
    12
    I will contact you in case any other problem occurs
     
  10. ganu07

    ganu07

    Joined:
    Feb 28, 2017
    Posts:
    12
  11. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    302
    If you are a beginner at scripting then that would be ideal and give you the basics for a training sim.

    That asset does not include the input system, the system you need to read your ANT usb dongle.

    But that asset fed with your ANT data (provided with a package I link above) should pretty much give a working demo.
     
  12. ganu07

    ganu07

    Joined:
    Feb 28, 2017
    Posts:
    12
    Ya i bought the Advanced Ant+ Package
     
  13. ganu07

    ganu07

    Joined:
    Feb 28, 2017
    Posts:
    12
    Hi SiliconDroid,
    Thank you for your help....i just finished my prototyping of my Bicycle R...the object is moving according to the speed it is receiving from the sensors and now i am trying to build the rotation stuff through controller.
     
    SiliconDroid likes this.
  14. rexcheung

    rexcheung

    Joined:
    Feb 2, 2017
    Posts:
    35
    Hi Ganu07,
    I am also working on such a VR bicycle project.
    I am still thinking how to solve the rotation.Could you share more on your idea...many thanks.
    Rex
     
  15. fzq19940709

    fzq19940709

    Joined:
    Jan 10, 2018
    Posts:
    1
    I am also working on such a VR bicycle project.
    I am still thinking how to solve the rotation.Could you share more on your idea...many thanks.
     
  16. enemali

    enemali

    Joined:
    May 29, 2017
    Posts:
    19
    another cheap approach i guess is to use two mobile phones , one attached to the pedal and the second slotted into your vr-headset. Then use Unity network to send the gyroscope or accelerator data from the phone attatched to the pedal to the headset
     
  17. i4mtheone

    i4mtheone

    Joined:
    May 16, 2018
    Posts:
    11
    Hey! We did exactly that with Bike2VR. We've made our own BT cadence & speed sensor, because reasons... but you'll be able to hook up any other if you know how bluetooth works and how to read characteristics. We tried ANT but came to conclusion that BT will be simplier to implement. Search AssetStore for unity BT plugins.

     
  18. Dois

    Dois

    Joined:
    Feb 15, 2015
    Posts:
    7
    Hi, I'm trying to do something similar as well. May I know what BT Plugin you're using?

    Thanks!
     
  19. limchanpiseth18

    limchanpiseth18

    Joined:
    Jun 23, 2019
    Posts:
    2
    Hi ganu07,
    Can we use this package to develop an oculus go app?
     
  20. RayGerry

    RayGerry

    Joined:
    Aug 13, 2021
    Posts:
    1
    Hello ganu07 , I hope to achieve the same function as you, how did you solve this problem in the end?Looking forward to receiving your answer.