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.
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?
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): using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { public float speed; void Update () { transform.position = new Vector3(0, 0, speed* Time.deltaTime); } } the code is a draft example that was not tested.
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
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.
Hey, I just noticed there are also a couple of ready made solutions on the asset store: https://www.assetstore.unity3d.com/en/#!/content/57137 https://www.assetstore.unity3d.com/en/#!/content/71980
Hey SiliconDroid, just take a look at this asset and tell me if this can help me in my project. https://www.assetstore.unity3d.com/en/#!/content/71573
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.
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.
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
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.
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
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.
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.