Page 1 of 1

Using a change in voltage as a trigger in Unity

Posted: Fri Sep 27, 2024 4:50 pm
by MemeVega
Hi, I'm making a game in unity and I have already managed to get the game to read the phidget bridge, however, I want to know if there is a way to make the player move whenever there is a change in the voltage reader. I'm new to phidgets and I have no idea of all the things that exists inside their library. Can someone please explain me how you're supposed to make it work or a alternative to solve my problem?

Re: Using a change in voltage as a trigger in Unity

Posted: Mon Sep 30, 2024 8:24 am
by mparadis
You should set up a VoltageRatioChange event handler, this function will trigger whenever the voltage changes. Then you just need your program to look at the value and decide how you want the object to move.

You should take a look at this sample project: Dial Phidget with Unity

This project uses the encoder and digitalInput object instead of VoltageRatioInput, but it should give you an idea of what your program will need to look like in order to control a character with Phidget input that comes from events.

Re: Using a change in voltage as a trigger in Unity

Posted: Mon Sep 30, 2024 11:45 am
by MemeVega
Thank you so much for your help. I´ve already done the code and I just need to test it out.