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.
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.setLatitude(location.getLatitude()+0.0003);
locationNinja.setLongitude(location.getLongitude());
locationNinja is an object of the Location class defined in android class android.location.Location. https://developer.android.com/reference/android/location/Location.html
So use:
locationNinja.setLatitude(location.getLatitude()+specificRadians);
locationNinja.setLongitude(location.getLongitude()+specificRadians);
Otherwise try messing with:
ninja.setLocalTranslation(0.0f, -2.5f, -50.0f);
in
public void initForegroundScene() method and see what you get.
Good luck
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).