LucaJunge / godot_arcore_plugin

MIT License
1 stars 1 forks source link

Couldn't find plugin ARCorePlugin in demo project #1

Closed Brennanzuz closed 2 weeks ago

Brennanzuz commented 2 weeks ago

First of all, thank you for creating this extension for ARCore support going into Godot 4. It might be the only way to get AR applications on Godot at the moment.

I've followed the instructions and the plugin builds properly, and I enable it in the demo:

image

Running the project will always print Couldn't find plugin ExportPlugin because the plugin name "ARCorePlugin" is not a singleton using Engine.has_singleton(_plugin_name).

Am I missing a step? Do I need to # TODO: Update to match your plugin's name when there is nothing to change (since the plugin name is already ARCorePlugin) and if so, would the instructions need to be changed to be clearer?

LucaJunge commented 2 weeks ago

Hey Brennanzuz, thanks for your interest in ARCore and this plugin :) Which Godot version are you using for testing? I'm using 4.2.2 and I haven't tested other versions yet.

Please note that this plugin is currently work in progress where I'm trying to combine multiple approaches from other contributors. A new unified approach will probably replace the existing one at GodotVR/godot_arcore, but in the meantime, I'm still testing stuff out here.

You shouldn't have to change the "#TODO: change plugin name" comments, as I have already done that. They come from the Android Plugin Template. The plugin should also create an Autoload called "ARCoreInstanceInterface". Does it do that for you?

Brennanzuz commented 2 weeks ago

Ah sorry for not specifying earlier, but I am using v4.3.stable.flathub [77dcf97d8]. This might be causing the issue?

Because despite enabling the plugin, the globals tab has nothing:

image

I downgraded to v4.2.2.stable.official [15073afe3] real quick but still had the same issue

LucaJunge commented 2 weeks ago

I haven't encountered that error before, I can take a closer look at that tomorrow

LucaJunge commented 2 weeks ago

I just set up the build environment on another pc but couldn't replicate the error. I suspect that the version change of the editor may have corrupted the demo project, maybe it works when resetting the demo project completely

Brennanzuz commented 2 weeks ago

Alright fantastic! It worked after I recloned, rebuilt and redid everything but opened it in Godot 4.2.2 first instead. I thought git reset --hard would solve the issue but it didn't :/

But now I have this other issue that Line 6:Could not find type "ARCoreInterface" in the current scope.

image

so I changed it to ARCoreInterfaceInstance and but now it shows Line 12:Invalid argument for "add_interface()" function: argument 1 should be "XRInterface" but is "res://addons/ARCorePlugin/ARCoreInterface.gd".:

image

Any clue what went wrong?

Brennanzuz commented 2 weeks ago

Also may I ask if this project can actually make an Android phone work with a Godot AR project? Like it can show objects around, but does it track the player's movements? i.e. if the person irl moves a few inches, would that be tracked by Godot?

LucaJunge commented 2 weeks ago

You don't have to change anything about the ARCoreInterface error. It shows up in the editor but the project should build regardless. I need to create a dummy class for the error to go away under Linux/Windows/Mac, but I'm not sure how to do that yet.

Tracking the environment the user is in is the goal, but the plugin is not ready yet. You should see the camera moving around when you click "Start AR" on your android phone though

Brennanzuz commented 2 weeks ago

Thank you for the info, I'll still try it out and give it a go.

Strangely, I cannot run the game (pressing the play button) as it will stop at the ARCoreInterface error, and give me a black screen. I'll need to export the project to an Android apk, but I'm getting this keystore error [Code Signing] Could not find keystore, unable to export, when I previously did not have it. Guess I have to follow the Exporting for Google Play Store instructions even though I'm not (?) Any advice?

LucaJunge commented 2 weeks ago

The demo will only work on an Android device, as the plugin is only available for this platform and not Windows Linux or Mac.

I also stumbled upon the debug keystore entry today. The part from the 4.2 docs seems to have gone missing, compare with: https://docs.godotengine.org/en/4.2/tutorials/export/exporting_for_android.html

Brennanzuz commented 2 weeks ago

Wow I got it to work on my phone! :pray: It looks so much more advanced than the simple MobileVRInterface approach I did :laughing: Though right now the viewport background is still showing that grey horizon and not my camera despite using get_viewport().transparent_bg = true

Would you say that this is the most advanced mobile AR implementation in Godot so far? I would be interested in looking at the source code if that's the case

LucaJunge commented 2 weeks ago

Nice! :D Yeah, the camera output requires support for external textures, like the device camera. That is still missing in the engine but there is a pull request for that as well, which needs to be merged into Godot.

Brennanzuz commented 2 weeks ago

Is there any way that you know of to be able to overlay the game's objects over the camera? Because without it, it's not really AR now is it?

LucaJunge commented 2 weeks ago

Sure, displaying the image is needed for AR, but so far only ARCore can access the camera image. There is a pull request that enables external image support here (https://github.com/godotengine/godot/pull/95187), which works, but you have to compile Godot for that to work.

As I said, all very much work in progress right now. If you want to work on that as well, I would suggest joining the Godot RocketChat

Brennanzuz commented 2 weeks ago

Thank you for explaining it to me (especially here)! I appreciate the hard work you all are making to make this possible! :pray: and I'll be looking into my options for my project. Good luck on your work :fire:

To close the issue, the steps I followed while on an Ubuntu based system are:

git clone https://github.com/LucaJunge/godot_arcore_plugin.git
cd godot_arcore_plugin/
git submodule update --init
cd godot-cpp
export ANDROID_HOME="~/Android/Sdk"
scons platform=android target=template_debug -j4
scons platform=android target=template_release -j4
cd ..
~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager --sdk_root=~/Android/Sdk --licenses
~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager --sdk_root=~/Android/Sdk "platform-tools" "build-tools;34.0.0" "platforms;android-34" "cmdline-tools;latest" "cmake;3.10.2.4988404" "ndk;23.2.8568313"
./gradlew assemble

Fill in path to Java SDK and Android SDK. For me:

Generate keystore:

keytool -keyalg RSA -genkeypair -alias androiddebugkey -keypass android -keystore debug.keystore -storepass android -dname "CN=Android Debug,O=Android,C=US" -validity 9999 -deststoretype pkcs12

And fill in: