Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - pakotbkr

Pages: [1]
Support / How to scale one object over another?
« on: March 31, 2017, 02:38:24 pm »
Hi, I want to use a cube as a transparent container and that all new objects that I add to the world, have the same size as this one

I tried to do it with setBoundingBox but it does not work for me
Code: [Select]
//Log.d("OBJECT3D", "estoy entrando");
cube = new Object3D(Primitives.getCube(1));
///////////////con un OBJ
try {
spider= Object3D.mergeAll(Loader.loadOBJ(mActivity.getModel3D(),mActivity.getMaterial3D(), 1f));
} catch (IOException e) {

float[] bb=cube.getMesh().getBoundingBox();
    float xDiff=bb[1]-bb[0];
    float yDiff=bb[3]-bb[2];
    float zDiff=bb[5]-bb[4];
    float s=cube.getScale();
  SimpleVector out = new SimpleVector(xDiff*s,yDiff*s,zDiff*s);

//Log.d("OBJECT3D", "he pasado!");
cube.translate(0, 0, 10);
    spider.setBoundingBox(bb[0], bb[1], bb[2], bb[3], bb[4], bb[5]);
    spider.translate(0, 0, 10);

light= new Light(world);
light.setIntensity(128, 128, 128);

Pages: [1]