Augmented Reality for UE4

Can you send me the 3D model to info@unreal4ar.com ? I am not sure what is going on without seeing it.

I already send you the last mesh, it is in the MergedMeshes folder.

Hey ,

Could you please take a look at this thread perhaps: Packaging Setting "Additional Non-Asset Directories to copy" not work with Android - Mobile - Epic Developer Community Forums

And maybe tell us if that person is doing something wrong? Because if we can’t get the data and dataNFT folders to copy over automatically, we can’t make an app that can be put on the play store (as far as my limited knowledge goes regarding creating apps). I’m having this same problem, it works after i copy over the folders manually. But I can’t get the packaging to include the ARtoolkit folder.
Thanks for your time.

While I’m not , I was able to successfully build for Android from version 1.5 and looking at the change logs:

AR Plugin V1.4 – 2016-01-20

– UnpackData function added for Android builds (extracts data from obb to ue4game)

Anything beyond that version should work as long as you include it in the “Additional Non-Added Directories To Copy” group.

Project Settings -> Packaging (Under the Project header) -> Click the button to expand for advanced fields -> At the bottom click the + next to the field -> navigate to the ARToolkit folder

Image below, hope this helps!

Hi Envaal,

Huogo was right, it works like he described above.

One more thing. Data content is copied into the .obb file, so you have to enable it. (Don’t disable it)
Single .apk installs won’t work.

Once the user installs your app from the market, UE4 will automatically download the corresponding .obb file and the plugin will unpack all the necessary data from it at first run.

Thank you for your responses! I figured it out, turns out the OBB is extracted to another folder if you don’t set all your project names (at packaging etc) to the exact same name.

Hi,
How i can include ARToolkitComponent.h to my c++ files ?

Compiler couldn’t found the file, I tried this style but not wroking:
#include “ARToolkitPlugin/Public/ARToolkitComponent.h”

ERROR : Cannot open include file: ‘ARToolkitPlugin/Public/ARToolkitComponent.h’: No such file or directory

Also i tried to add this code to build file but complier get another error:

PrivateDependencyModuleNames.AddRange(new string] {“ARToolkitPlugin” });

[2016.06.20-22.16.59:374][444]CompilerResultsLog:Error: Error c:\users…\plugins\artoolkitplugin\source\artoolkitplugin\public\ARToolkitFunctionLibrary.h(59) : error C3646: ‘matrix’: unknown override specifier
[2016.06.20-22.16.59:374][444]CompilerResultsLog:Error: Error c:\users…\plugins\artoolkitplugin\source\artoolkitplugin\public\ARToolkitFunctionLibrary.h(59) : error C2143: syntax error: missing ‘,’ before ‘’
[2016.06.20-22.16.59:374][444]CompilerResultsLog:Error: Error c:\users…\plugins\artoolkitplugin\source\artoolkitplugin\public\ARToolkitFunctionLibrary.h(59) : error C2143: syntax error: missing ‘)’ before ‘;’
[2016.06.20-22.16.59:374][444]CompilerResultsLog:Error: Error c:\users…\plugins\artoolkitplugin\source\artoolkitplugin\public\ARToolkitFunctionLibrary.h(59) : error C2238: unexpected token(s) preceding ‘;’
[2016.06.20-22.16.59:375][444]CompilerResultsLog:Error: Error c:\users…\plugins\artoolkitplugin\source\artoolkitplugin\public\ARToolkitFunctionLibrary.h(64) : error C2143: syntax error: missing ‘;’ before ‘*’
[2016.06.20-22.16.59:375][444]CompilerResultsLog:Error: Error c:\users…\plugins\artoolkitplugin\source\artoolkitplugin\public\ARToolkitFunctionLibrary.h(64) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
[2016.06.20-22.16.59:375][444]CompilerResultsLog:Error: Error c:\users…\plugins\artoolkitplugin\source\artoolkitplugin\public\ARToolkitFunctionLibrary.h(64) : error C2238: unexpected token(s) preceding ‘;’
[2016.06.20-22.16.59:375][444]CompilerResultsLog:Error: Error c:\users…\plugins\artoolkitplugin\source\artoolkitplugin\public\ARToolkitFunctionLibrary.h(65) : error C3646: ‘filterCutoffFrequency’: unknown override specifier
[2016.06.20-22.16.59:375][444]CompilerResultsLog:Error: Error c:\users…\plugins\artoolkitplugin\source\artoolkitplugin\public\ARToolkitFunctionLibrary.h(65) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
[2016.06.20-22.16.59:375][444]CompilerResultsLog:Error: Error c:\users…\plugins\artoolkitplugin\source\artoolkitplugin\public\ARToolkitFunctionLibrary.h(66) : error C3646: ‘filterSampleRate’: unknown override specifier
[2016.06.20-22.16.59:375][444]CompilerResultsLog:Error: Error c:\users…\plugins\artoolkitplugin\source\artoolkitplugin\public\ARToolkitFunctionLibrary.h(66) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

So i’ve been messing with this for a bit now, and I noticed the actual object is being moved instead of the camera. Does this mean we won’t be able to use lightmass on an object? Is there a way to make the object stationary and have the camera move around instead?

Hey ,

I’m having the same problem on my Nexus 9! Did you have any luck with it since?

If you want to move the camera not the subject you need to use the Camera Posiition / Camera Rotation outputs of the GetMarker node.
http://www.unreal4ar.com/get-marker/

Check out the motorbike example for reference.

Man… i really need to learn how to read :rolleyes:

Hi!

Apologies if this info is already out there, I couldn’t find it searching through this thread.

Anyway, just popping in to quickly share the fix that worked for me after hitting this error when building for android:
Note: This is using Commercial Plugin V1.5R1

LogPlayLevel: UnrealBuildTool: [1/2] clang++.exe Module…cpp [armv7-es2]
LogPlayLevel: UnrealBuildTool: In file included from G:/Timecode/TEST/ARTest/Intermediate/Build/Android/ARTest/Development//Module…cpp:3:
LogPlayLevel: UnrealBuildTool: G:\UnrealEngine\Engine\Source\Runtime\Private\Android\AndroidJNI.cpp(873,2) : error: ‘delete’ applied to a pointer that was allocated with ‘new]’; did you mean ‘delete]’? -Werror,-Wmismatched-new-delete]
LogPlayLevel: UnrealBuildTool: delete buf;
LogPlayLevel: UnrealBuildTool: ^
LogPlayLevel: UnrealBuildTool: ]
LogPlayLevel: UnrealBuildTool: G:\UnrealEngine\Engine\Source\Runtime\Private\Android\AndroidJNI.cpp(868,21) : note: allocated with ‘new]’ here
LogPlayLevel: UnrealBuildTool: signed char* buf = new signed char[len];
LogPlayLevel: UnrealBuildTool: ^
LogPlayLevel: UnrealBuildTool: 1 error generated.
LogPlayLevel: UnrealBuildTool: ERROR: UBT ERROR: Failed to produce item: G:\Timecode\TEST\ARTest\Binaries\Android\ARTest-armv7-es2.so

Basically you need to do exactly what the error message says :stuck_out_tongue:

Head on down to line 873 of Android JNI.cpp and change delete buf; to delete] buf;
There is no need to rebuild the engine as the file is linked only at packaging time as far as I can tell.

Hopefully this helps someone out there.

Many thanks to for the awesome plugin!!

I had this problem a few days ago :smiley: .

do you have any suggest for post #347 ?

I have this same problem, did you guys figure this out?

Edit:
This also occurs with a binary installation of the UE4 editor. Seems more is going on…

Edit2:

There we go: Why render is distorted in mobile? - Rendering - Epic Developer Community Forums

Hi Vahid!

I’m a bit busy today so I didn’t get to look into it much, but I did find that I could get it to compile as follows:

In MyGameMode.cpp
include “ARToolkitComponent.h”

In MyGame.Build.cpp
PublicDependencyModuleNames.AddRange(new string] { “Core”, “CoreUObject”, “Engine”, “InputCore”, “ARToolkitPlugin”, “ARToolkit” });

In Plugins/ARToolkit/ARToolkitFunctionLibrary.h, at the top of the file above include “ARToolkitFunctionLibrary.generated.h”

#ifdef _WIN64
include “AllowWindowsPlatformTypes.h”

include <dshow.h>
#pragma comment(lib, “strmiids”)
#endif

#if defined APPLE
import <AVFoundation/AVFoundation.h>
import <CoreVideo/CoreVideo.h>
#endif

include <AR/video.h>
include <AR/ar.h>
include <AR/config.h>
include <AR/param.h>

//NFT
include <AR/arMulti.h>
include <AR/arFilterTransMat.h>
include <AR2/tracking.h>

#ifdef _WIN64
include “HideWindowsPlatformTypes.h”
#endif

Which comes from the private precompiled headers for the plugin. I’m guessing ARFilterTransMatInfo & ARdouble types are defined somewhere in there and since they are in precompiled header, when another assembly tries to compile them it can’t find them.

It’s not much of a solution but hopefully it can provide a path for investigation :slight_smile:

Thanks for your reply, It’s ok and i could compile engine.
And when i trying to include in MyGameCamera.h



#include "ARToolkitComponent.h"

UPROPERTY(VisibleDefaultsOnly, Category = "AR")	
UARToolkitComponent* ARTool;


and then in MyGameCamera.cpp


ARTool = CreateDefaultSubobject<UARToolkitComponent>(TEXT("ARTool"));


Compiler Error is :


CompilerResultsLog: Info    Creating library C:\Users\...\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyGame-2077.lib and object C:\Users\...\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyGame-2077.exp
CompilerResultsLog:Error: Error MyGameCamera.cpp.obj : error LNK2019: unresolved external symbol "private: static class UClass * __cdecl UARToolkitComponent::GetPrivateStaticClass(wchar_t const *)" (?GetPrivateStaticClass@UARToolkitComponent@@CAPEAVUClass@@PEB_W@Z) referenced in function "public: class UARToolkitComponent * __cdecl UObject::CreateDefaultSubo
bject<class UARToolkitComponent>(class FName,bool)" (??$CreateDefaultSubobject@VUARToolkitComponent@@@UObject@@QEAAPEAVUARToolkitComponent@@VFName@@_N@Z)
CompilerResultsLog: Info LINK : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
CompilerResultsLog: Info    Creating library C:\Users\...\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyGame-2077.lib and object C:\Users\...\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyGame-2077.exp
CompilerResultsLog:Error: Error MyGameCamera.cpp.obj : error LNK2001: unresolved external symbol "private: static class UClass * __cdecl UARToolkitComponent::GetPrivateStaticClass(wchar_t const *)" (?GetPrivateStaticClass@UARToolkitComponent@@CAPEAVUClass@@PEB_W@Z)
CompilerResultsLog:Error: Error C:\Users\...\Binaries\Win64\UE4Editor-MyGame-2077.dll : fatal error LNK1120: 1 unresolved externals
CompilerResultsLog: Info ERROR: UBT ERROR: Failed to produce item: C:\Users\...\Binaries\Win64\UE4Editor-MyGame-2077.dll

Also I tried adding ELEMENTAL_API to UARToolkitComponent but i couldn’t compile plugin

class ELEMENTAL_API UARToolkitComponent : public USceneComponent

Hi Vahid!

I can’t test it right away, but off the top of my head does your MyGame.Build.cpp contain the ARToolkitPlugin and ARToolkit in PublicDepencyModuleNames?

Also does your C++ project have a Plugins folder in the root (\MyGame\Plugins) containing the ARToolkitPlugin and ARToolkit folders from the Unreal4AR zip file (Path is \SampleProject\Plugins\ARToolkitPlugin & \SampleProject\Plugins\ARToolkitPlugin\Source\ThirdParty\ARToolkit respectively)?

Actually you might not need the ARToolkit at all, just ARToolkitPlugin.
I just did some quick & dirty copy pasting this morning, lol.

MyGame.Build.cpp :
PublicDependencyModuleNames.AddRange(new string] { “Core”, “CoreUObject”, “Engine”, “InputCore”, “ARToolkitPlugin”, “ARToolkit” });

and Yes i have those folder

Also I tried adding ELEMENTAL_API to UARToolkitComponent but i couldn’t compile plugin

class ELEMENTAL_API UARToolkitComponent : public USceneComponent

Is there a way to see how the model will be projected on the marker? ie. I have a marker with a city plan and I want to place houses on their respective lots. Now it’s kind of guesswork to see where the model is going to end up relative to the marker.

No direct way for that, but you can add a plane with the texture of the marker to your scene and use it for reference.