Announcement

Collapse
No announcement yet.

Augmented Reality for UE4

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Hello,

    Try to add new permissions to the ARToolkitPlugin_APL.xml located in:
    SampleProject\Plugins\ARToolkitPlugin\Source\ARToolkitPlugin\ARToolkitPlugin_APL.xml

    Currently it has the following:

    <androidManifestUpdates>
    <addPermission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"/>
    <addPermission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <addPermission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <addPermission android:name="android.permission.CAMERA" />
    <addPermission android:name="android.permission.FLASHLIGHT"/>
    <addFeature android:name="android.hardware.camera" />
    <addFeature android:name="android.hardware.camera.autofocus" android:required="false"/>
    <addFeature android:name="android.hardware.camera.flash" android:required="false"/>
    </androidManifestUpdates>


    Can you please send me your logs when you get the white screen ? Does it happen only if you install it from google play?



    Originally posted by WillLeap View Post
    I have narrowed the problem down to the permission changes in Android SDK 23+. If I go into settings -> apps -> myapp -> permissions and enable both the camera and storage, then my app will load and the camera works. I tried to request android.permission.CAMERA and android.permission.READ_EXTERNAL_STORAGE at runtime using the Request Android Permission blueprint node before ARToolKit Component Init inside of the ARToolkitBaseAdvanced blueprint, I get a white screen until i restart the app at which point everything works correctly. I'm guessing I need to call the permission request even earlier but I'm not sure where to put it or if it needs to be done somewhere in code.

    AdamHorvath, any ideas on how to solve this?
    AR plugin for UE4
    AR Virtual Mirror plugin for UE4
    Red Alert 2 VR remake
    Armed Island VR RTS

    Comment


      Originally posted by AdamHorvath View Post
      Hello,

      Try to add new permissions to the ARToolkitPlugin_APL.xml located in:
      SampleProject\Plugins\ARToolkitPlugin\Source\ARToolkitPlugin\ARToolkitPlugin_APL.xml

      Currently it has the following:

      <androidManifestUpdates>
      <addPermission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"/>
      <addPermission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
      <addPermission android:name="android.permission.READ_EXTERNAL_STORAGE" />
      <addPermission android:name="android.permission.CAMERA" />
      <addPermission android:name="android.permission.FLASHLIGHT"/>
      <addFeature android:name="android.hardware.camera" />
      <addFeature android:name="android.hardware.camera.autofocus" android:required="false"/>
      <addFeature android:name="android.hardware.camera.flash" android:required="false"/>
      </androidManifestUpdates>


      Can you please send me your logs when you get the white screen ? Does it happen only if you install it from google play?


      This was happening when launching from within the editor, publishing and deploying using the install script, and on the Google Play Store. I found a few posts talking about the storage issue and it sounds like that might only be related to certain Samsung phones which is what I am using to test.

      The problem ended up being that Android requires you to request at run time the permissions to access the camera and storage when using SDK 23 or higher. The Google Play store requires a minimum target SDK of 26 so the app was never requesting permission since it has to be added in code and not just the manifest like it use to be prior to SDK 23.

      I was on the right track but didn't realize the blueprint node Request Android Permissions did the request asynchronously so the app wasn't waiting for the user to make a choice before continuing initializing the plugin. That blueprint node returns a callback proxy object that allows you to bind an event. Calling the ARToolkit plugin's Init function and setup in my bound event was then throwing an error saying the plugin code needed to run on the game thread.

      I got it all working by using a boolean variable to determine if the user had given all of the proper permissions yet and then have it check on the tick event. Once a user gives permission the next call to tick allows the plugin init code to run once and it's in the correct thread so it works.

      Comment


        Hello Adam This plug-in does not support Chinese, does it?
        I put the published files in the Chinese directory. Then he could not find the camera.

        Comment


          Unfortunately not. I could not managed to use directories with special characters,

          Originally posted by 少爷骑龙到你家 View Post
          Hello Adam This plug-in does not support Chinese, does it?
          I put the published files in the Chinese directory. Then he could not find the camera.
          AR plugin for UE4
          AR Virtual Mirror plugin for UE4
          Red Alert 2 VR remake
          Armed Island VR RTS

          Comment


            Thanks for the solution, and the detailed explanation! I'll do some tests with this, and update the sample projects accordingly.

            Originally posted by WillLeap View Post

            This was happening when launching from within the editor, publishing and deploying using the install script, and on the Google Play Store. I found a few posts talking about the storage issue and it sounds like that might only be related to certain Samsung phones which is what I am using to test.

            The problem ended up being that Android requires you to request at run time the permissions to access the camera and storage when using SDK 23 or higher. The Google Play store requires a minimum target SDK of 26 so the app was never requesting permission since it has to be added in code and not just the manifest like it use to be prior to SDK 23.

            I was on the right track but didn't realize the blueprint node Request Android Permissions did the request asynchronously so the app wasn't waiting for the user to make a choice before continuing initializing the plugin. That blueprint node returns a callback proxy object that allows you to bind an event. Calling the ARToolkit plugin's Init function and setup in my bound event was then throwing an error saying the plugin code needed to run on the game thread.

            I got it all working by using a boolean variable to determine if the user had given all of the proper permissions yet and then have it check on the tick event. Once a user gives permission the next call to tick allows the plugin init code to run once and it's in the correct thread so it works.
            AR plugin for UE4
            AR Virtual Mirror plugin for UE4
            Red Alert 2 VR remake
            Armed Island VR RTS

            Comment


              any chance you could increase the types of barcodes? such as AR_MATRIX_CODE_5x5 instead of 3x3. I want to inventory a lot of items.

              Comment


                Hi everyone!,

                I need help please. I try to oppen my ARapp on my LgG4, but the app crash when i will open it. The msn is "error unfortunately [App] has stopped". I test the proyect on my pc with webcam and its run good. I was testing too with UNREAL4AR app, and its run good. Its should be the same app right?

                I have got paid Version.

                Ty for all!
                Last edited by ChipironBoy; 09-03-2018, 07:21 AM.

                Comment


                  Hello!

                  I've recently purchased this plugin, but have been unable to make it work on my android device (a Moto G5 Plus running Android 7.0) when installing through the .bat or Play Store.

                  The issue I am facing is that there is no camera feed - all I see is a blank background. When I Launch from editor on my device, such problem does not occur and all works fine when using a webcam.

                  Here is what I already did, after researching the posts here:

                  - I am requesting Camera and Storage permissions before calling the Init node in my blueprints;
                  - I am not packaging everything inside a single .apk;
                  - I already changed the obb path variable within the .xml, as explained in the Android Quick Start;

                  The output from adb logcat tells me:

                  Code:
                  09-27 11:45:26.992 16016 16035 E libar   : Error (2): unable to open camera parameters file "/storage/emulated/0/Android/data/com.Test.AR/files/UE4Game/Unreal4AR/Unreal4AR/Content/ARToolkit/Data/camera_para.dat" for reading.
                  09-27 11:45:26.992 16016 16035 E libar   : No such file or directory
                  Which apparently should have been fixed by changing the obb path in the .xml file

                  Also, this error seems to only happen the first time I open the app (I show an error message when Init returns false). After that, every time I execute the app, it seems to be working, despite no camera feed coming through and no target being recognized.

                  Really, I am at a loss as to what I can do here.

                  Comment


                    Hello,

                    I think the path is not valid:
                    /storage/emulated/0/Android/data/com.Test.AR/files/UE4Game/Unreal4AR/Unreal4AR/Content/ARToolkit/Data/camera_para.dat" There is an extra Unreal4AR in it. Can you please check ?



                    Originally posted by blkhouse_vlucki View Post
                    Hello!

                    I've recently purchased this plugin, but have been unable to make it work on my android device (a Moto G5 Plus running Android 7.0) when installing through the .bat or Play Store.

                    The issue I am facing is that there is no camera feed - all I see is a blank background. When I Launch from editor on my device, such problem does not occur and all works fine when using a webcam.

                    Here is what I already did, after researching the posts here:

                    - I am requesting Camera and Storage permissions before calling the Init node in my blueprints;
                    - I am not packaging everything inside a single .apk;
                    - I already changed the obb path variable within the .xml, as explained in the Android Quick Start;

                    The output from adb logcat tells me:

                    Code:
                    09-27 11:45:26.992 16016 16035 E libar : Error (2): unable to open camera parameters file "/storage/emulated/0/Android/data/com.Test.AR/files/UE4Game/Unreal4AR/Unreal4AR/Content/ARToolkit/Data/camera_para.dat" for reading.
                    09-27 11:45:26.992 16016 16035 E libar : No such file or directory
                    Which apparently should have been fixed by changing the obb path in the .xml file

                    Also, this error seems to only happen the first time I open the app (I show an error message when Init returns false). After that, every time I execute the app, it seems to be working, despite no camera feed coming through and no target being recognized.

                    Really, I am at a loss as to what I can do here.
                    AR plugin for UE4
                    AR Virtual Mirror plugin for UE4
                    Red Alert 2 VR remake
                    Armed Island VR RTS

                    Comment


                      Originally posted by AdamHorvath View Post
                      Hello,

                      I think the path is not valid:
                      /storage/emulated/0/Android/data/com.Test.AR/files/UE4Game/Unreal4AR/Unreal4AR/Content/ARToolkit/Data/camera_para.dat" There is an extra Unreal4AR in it. Can you please check ?
                      I've sent an e-mail, but we can keep the discussion here for future reference to others, if you are okay with it.

                      I am not sure how to change this - from what I could gather of your plugin, this path is set in the file "ARTolkitDevice.cpp" and the problem seems to be at line 114, where "AbsoluteContentPath" is set

                      Code:
                      //ANDROID
                      #if defined __ANDROID__
                          FString AbsoluteContentPath = GFilePathBase + TEXT("/UE4Game/") + FApp::GetProjectName() + TEXT("/") + FString::Printf(TEXT("%s/Content/"), FApp::GetProjectName());
                          DataPath = AbsoluteContentPath + FString("ARToolkit/");
                      #endif
                      From the looks of it, you are getting the project name twice - is this the problem then?


                      =-=-=-=-=-=-=-=EDIT=-=-=-=-=-=-=-=

                      Upon further inspection, this path seems to be correct. When installed directly from Unreal (through the launch options), a "Unreal4AR" folder is created within the UE4Game folder (located in the root of my device) and all that path (including the Unreal4AR/Unreal4AR) is perfectly correct.

                      But when installing through the .bat OR PlayStore, such folder is not there. That's why, when I install it through the Editor and later through any other means, the app works - because the folder is already there.

                      My guess then is that either I am setting things up incorrectly in the packaging process (most probable), or the plugin is missing something somehow.

                      But still, I followed every step, deactivated all checkbox that should (as far as I understood) be deactivated... so I am truly at a loss
                      Last edited by blkhouse_vlucki; 09-27-2018, 04:10 PM.

                      Comment


                        Hi Developer , we are using your plugin to create some applications for android ,
                        and we are facing some issues with it , In Editor everything works fine but when we package it for android , we are not able to see any camera output , all we can see is a white screen (which we guess is the plane which is infront of the camera ) , We are working on a demo project from the official website and the plugin we are using is a commercial one .
                        Please help us
                        ThankYou .

                        Comment


                          Hello, I'm in the same situation that blkhouse_vlucki. The strange thing is when I create a project from the sample project, I have no problem, but when I do with a blank project and adding the plugin by hand, the ARToolkit folder is not copied.
                          I'm working with UE4.20. I just wonder why this difference !

                          Comment


                            Hi, in our company we are interested in buying your pluggin, the commercial version, testing the harley demo, it only allows us to go 2 meters from the camera, more than that and it will stop tracking the marker. Is there a way to get more distance from the camera? 4 meters it would be the ideal distance.

                            Comment


                              Hi,

                              You can use bigger markers to have more distance from the camera.



                              Originally posted by Invius View Post
                              Hi, in our company we are interested in buying your pluggin, the commercial version, testing the harley demo, it only allows us to go 2 meters from the camera, more than that and it will stop tracking the marker. Is there a way to get more distance from the camera? 4 meters it would be the ideal distance.
                              AR plugin for UE4
                              AR Virtual Mirror plugin for UE4
                              Red Alert 2 VR remake
                              Armed Island VR RTS

                              Comment


                                This problem is just make dir.
                                like this


                                InputStream is;
                                ZipInputStream zis;
                                try
                                {
                                String filename;
                                String FileFullPath;
                                String filepath;

                                is = new FileInputStream(path +"/"+ zipname);
                                zis = new ZipInputStream(new BufferedInputStream(is));
                                ZipEntry ze;
                                byte[] buffer = new byte[1024];
                                int count;

                                while ((ze = zis.getNextEntry()) != null)
                                {

                                filename = ze.getName();
                                FileFullPath = pathDest + filename;
                                filepath = (FileFullPath).substring(0,FileFullPath.lastIndexOf(File.separator));

                                Log.debug(" ############### filename: ############ " + filename);
                                //extract only artoolkit related stuff
                                if (filename.toLowerCase().contains("artoolkit"))
                                {
                                // Need to create directories if not exists, or
                                // it will generate an Exception...

                                File f = new File(filepath);
                                if(!f.exists())
                                {
                                Log.debug(" ############### Not Exist Folder ############ " + filepath);
                                f.mkdirs();
                                }

                                switch plugin UPL Code in

                                String zipname = obbName;
                                < In this code >
                                if (ze.isDirectory())

                                Comment

                                Working...
                                X