charlielobster / MagneticFields

Unity AR Foundation Magnetic Fields Visualization
2 stars 0 forks source link

The code can not run. Could you fix it? Thank you! #1

Closed gascendcn closed 1 year ago

gascendcn commented 2 years ago

The code can not run. Could you fix it? Thank you!

charlielobster commented 2 years ago

hi gascendcn, thanks for checking out the code! i will try and help you out!

charlielobster commented 2 years ago

gascendcn, how are you building the code (windows, mac?) and what's your target device os (ios, android)?

gascendcn commented 2 years ago

I am buliding the code on windows. my target device os is android.

image

when running, the isValid is false on the screen. Thanks for your help.

charlielobster commented 2 years ago

Hey gascendcn,

I hope all is well with you. Sorry for taking so long, I haven't forgot about you! I just built and deployed successfully using my original configuration and am unable to replicate your issue. My laptop is the original machine I used to compile and build the application, and I haven't changed it much since then. It is still working as expected. The UI is pretty wonky...I need to work on that a bit.

Let me get a little more information from you first...

What version of Unity Editor are you running? The version I have that builds ok at the moment is 2019.2.6f1, but I am working on upgrading it.

What version of Visual Studio are you running? There is a C#-based component of the code-base that currently uses VS Community 2019. This piece includes includes the core kd-tree implementation.

What OS is your target device running? The Google Pixel 3 I am using is Android v12.

Did you enable developer mode on the device?

What is your target device's make and model?

From what I can tell, the IsValid flag is only set to false here, on line 179 of Reading.cs:

                case DeviceOrientation.FaceUp:
                    // FaceUp appears to be off by a PI rotation about some axis
                case DeviceOrientation.FaceDown:
                case DeviceOrientation.Unknown:
                default:
                    // these have issues
                    m_rawVector = rawVector;
                    m_isValid = false;
                    break;

Thus, it appears that the application is unable to recognize the orientation of your device, for some strange reason (probably needs a upgrade to the api call used to get orientation).

The vectors are all reading 0 for you as well, which implies maybe it doesn't have rights to read the device's magnetometer. That could also be an issue.

It's been a couple of years since I've touched this code, but I'm making this issue a priority, so I will make steady progress, but it may take a few more days before I can nail down what's going on.

My development environment of choice, a desktop PC, is giving me grief about C drive space. On my desktop machine, I am presently working on upgrading the application to use a current version of Unity Editor (perhaps 2022). I want to create an iOS version as well, once we resolve the current issue you're having. I will be using the Google Pixel 3 device to test the upgrades on and will update you as soon as I get somewhere with that. I have an iPhone 8 for the iOS target device, once I get that far.

Regards, Erik

gascendcn commented 2 years ago

Could you upload the upgrade version code? The older version code is missing some script configuration, so it can't run. Thanks a lot!

charlielobster commented 2 years ago

Please stay tuned a few more days. Updates coming shortly.

charlielobster commented 1 year ago

hey gascendcn, this is resolved in the latest committo the master branch. Please let me know if you still have any issues. Thank you again for your help!