Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotate ARImageTrackingActionsImpl base node, use dimensions for android addImage, center align android image, load trackables in bg #65

Merged
merged 9 commits into from
Sep 12, 2019

Conversation

nickolanack
Copy link
Collaborator

No description provided.

@nickolanack
Copy link
Collaborator Author

nickolanack commented Sep 12, 2019

There is a Quaternion to Euler rotation conversion included in this PR that is not related to the ImageTracking issue but I accidentally included it. - i need camera rotation for my own purposes... (It is useful although I would think google will just implement this at some point)

src/ar.android.ts Outdated Show resolved Hide resolved
@nickolanack
Copy link
Collaborator Author

nickolanack commented Sep 12, 2019

for addImage I added a Sizer - but it is width or height only... (not both)

@nickolanack
Copy link
Collaborator Author

nickolanack commented Sep 12, 2019

with the scale factor (0.25) and sizer in addImage, the favorite icon should work (more or less) without platform specific sizing ie:

 args.imageTrackingActions.addImage({
                image: `~/app/images/favorite-${pokemon.favorite ? 'on' : 'off'}.png`,
                dimensions: {
                    x: 3,
                    y: 3
                },
                position: {
                    x: 3.5 ,
                    y: -1.6,
                    z: 0
                },
                scale: 1,
                onTap: toggleFavorite
            }).then(node => favNode = node);

and update session config (should work on first load)
@nickolanack
Copy link
Collaborator Author

Updated to load tracking images in background and also call session.configure() after adding tracking image. tracked images should work on first attempt (not require opening AR twice...) but still has a long delay before camera renders

@nickolanack
Copy link
Collaborator Author

center aligned android addImage node (was anchored to bottom)

@nickolanack nickolanack changed the title Rotate ARImageTrackingActionsImpl base node and use dimensions for android addImage Rotate ARImageTrackingActionsImpl base node, use dimensions for android addImage, center align android image, load trackables in bg Sep 12, 2019
@nickolanack
Copy link
Collaborator Author

Implemented the android playVideo method in ARImageTrackingActions also center aligned video nodes (was bottom aligned )

@nickolanack
Copy link
Collaborator Author

@EddyVerbruggen - I'm gonna leave it there for tonight, I can't see the model floating over Eevee.jpg, but the favorite icon and the video is working ok on android for me

@nickolanack
Copy link
Collaborator Author

we need a way to read image width in meters for android, maybe it should look for Contents.json in folder...

@EddyVerbruggen
Copy link
Owner

Re: "we need a way to read image width in meters for android, maybe it should look for Contents.json in folder..." that's a good point. I actually ignored those dimensions until now. I just corrected the image widths in demo-pokemon and now I'll have to adjust a few scale/dimension properties in the .ts code to compensate as they were specified as "4 meter" while actually they are "5 centimeters" 🤣

@EddyVerbruggen EddyVerbruggen merged commit 4e0c008 into EddyVerbruggen:master Sep 12, 2019
@EddyVerbruggen EddyVerbruggen added this to the 1.0.0 milestone Sep 12, 2019
@EddyVerbruggen
Copy link
Owner

At first I had trouble making Android recognize images but then I read ARCore prefers real life images (the things you actually "film") of at least 15x15 cm.. which is way larger that the Pokemon cards I'm using. So I printed one on A4/Letter size and it works much better. 😃

Most of the model/image sizes have been fixed on iOS, tomorrow I'll take a closer look at the Android scales and UI of the Pokemon demo app.

@nickolanack
Copy link
Collaborator Author

nickolanack commented Sep 12, 2019

Oh nice!
Keep in mind that this line

const definedWidth = 4;
has that hard coded value of 4m width. But needs to be read from config - but you might want to set it to 0.05 temporarily since you updated those model widths - that way your demo app shouldn’t need android specific scale

...also that scale factor does not affect the video, just the favorite icon and models

@EddyVerbruggen
Copy link
Owner

Since we now have the models of a few Pokemon for both platforms (I used a cmd line tool to convert .dae to .glb) I've now added a few to the SolarSystem demo (tested on iOS, will need scale-fixes on Android).

Someone should warn Elon! 🙀

IMG_3936

@nickolanack
Copy link
Collaborator Author

Lol

@nickolanack
Copy link
Collaborator Author

android studio has a way to package an image tracking database. I'll try to add support for that later... It'll probably speed up loading time alot.

@nickolanack
Copy link
Collaborator Author

Screenshot_20190912-143914
Dang, that is android with just IOS dimensions/scale (stripped all android specifics in augment-card.component.ts) and set definedWidth=0.05

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants