Augmented Reality for Android Application


I am following the “Augmented Reality for Android Application Development” Book.
Using JME 3.1.0 Stable version for the development.

Currently I am doing the Chapter 4, that describe rendering a model on a Specific Location. The below is the link to available project.

I could render the models with mesh.xml or .j3o or some .obj formats successfully . Even though when I set a Location Coordinates for the model, it always render on a same location. for an instance if i set a location which is far away from the mobile, it always renders infront of camera’s video see through (Say I set the values for a location which is behind me ).

I hope this happens due to incorrect handling of camera based on the location, But I couldn’t find the correct solution yet.
What could be the reason, if anyone know the fix please share.

Use move() instead of setLocalTranslation().
If that doesn’t work,paste your source code.

I will provide as much of a solution as you’ve provided code.


I tried with move() method, it doesn’t work.
I will add the codes

This is the project I am referring.

inside LocationAccessJME class in the setUserLocation(Location location) method, I changed the poi’s(ninja’s) location to a Specific one.
locationNinja.setLatitude(“specific latitude”);
locationNinja.setLongitude(“specific longitude”);
earlier it was

locationNinja is an object of the Location class defined in android class android.location.Location.
So use:

Otherwise try messing with:
ninja.setLocalTranslation(0.0f, -2.5f, -50.0f);
public void initForegroundScene() method and see what you get.
Good luck :slight_smile:

I was altering ninja.setLocalTranslation(0.0f, -2.5f, -50.0f); method, but no expected outputs received.

Do you know ?
How these LocationAccessJMEActivity and LocationAccessJME classes relate?

LocationAccessJMEActivity is the MainActivity , LocationAccessJME is the extended from SimpleApplication.
When LocationAccessJMEActivity starts model in the LocationAccessJME is loaded.

but I wanted to load the model on a button click from MainActivity(LocationAccessJMEActivity).