2

I have altered the code from the Google samples' AugmentedRealitySample like this:

Boolean useBasicObjectInsteadOf3DModel = false;

        if (useBasicObjectInsteadOf3DModel) {
            // This is the original code provided by the Google sample.
            // The mObject is an Object3D.
            // Build a Cube and place it initially in the origin.
            mObject = new Cube(CUBE_SIDE_LENGTH);

        } else {
            // This is the new code
            LoaderOBJ objParser = new LoaderOBJ(mContext.getResources(), mTextureManager, R.raw.object_obj);
            try {
                objParser.parse();
                mObject = objParser.getParsedObject();
            } catch (ParsingException e) {
                e.printStackTrace();
            }
        }

        mObject.setMaterial(material);
        mObject.setPosition(0, 0, -3);
        mObject.setRotation(Vector3.Axis.Z, 180);
        getCurrentScene().addChild(mObject);

When setting useBasicObjectsInsteadOf3dModel to true, the object sticks to a point in the real world (e.g. a wall). When setting to false, the objects position seems to be set so that the Tango device is in the middle of the object, and the object moves along with the tablet. However, the rotation of the object seems to work, as it moves much like the needle in a compass.

The question is: how is it possible to make the object loaded through the LoaderOBJ stick to a point in the real world?

andMarkus
  • 960
  • 1
  • 8
  • 16

0 Answers0