31
Support / How to place object at specific location of world?
« on: March 24, 2017, 04:37:34 am »
I wanna place an object at the bottom right corner of world with the following code, it doesn't work.
How to place object at specific location of world?
How to place object at specific location of world?
Code: [Select]
Texture waterMarkTexture = new Texture(BitmapHelper.rescale(BitmapHelper.convert(context.getResources().getDrawable(R.drawable.logo_camino_white)), 128, 128));
boolean isWaterMarkTextureAdded = TextureManager.getInstance().containsTexture("watermark");
if (!isWaterMarkTextureAdded) {
TextureManager.getInstance().addTexture("watermark", waterMarkTexture);
}
Object3D waterMarkModel = Primitives.getPlane(1, AppUtils.dp2px(context, 4));
waterMarkModel.setTexture("watermark");
int screenX = AppUtils.getScreenWidthPixels(context) - 20;
SimpleVector position = Interact2D.reproject2D3DWS(world.getCamera(), frameBuffer, screenX, screenX);
waterMarkModel.setOrigin(position);
waterMarkModel.build();
world.addObject(waterMarkModel);