Trying to recreate SenselContacts example for Unity and "contacts" doesn't return a value


#1

Hi,

I am trying to recreate the SenselContacts.cs example for Unity.
I’ve had success displaying force values with the script, however, for some reason, the number of contacts and everything connected to that (positions etc.) returns empty. I have attached the script, could you please take a look what am I doing wrong?

Thanks!


#2

Hello, thanks for contacting us. All you need to do is change:
Sensel.senselSetFrameContent(_handle, 1);
to
Sensel.senselSetFrameContent(_handle, 5);

SetFrameContent changes the data that is sent in each frame by way of a bitmask. 1 is force values, 2 is labels (force frame split into contacts), 4 is contacts and 8 is the accelerometer.


#3

Oh, how did I miss that. Thank you!


#4

If anyone needed the SenselContacts example for Unity, here you go. This script prints out the input ID, xPos, yPos, total force, and area.