Author Topic: Initial position and rotation  (Read 3457 times)

Offline alakat

  • byte
  • *
  • Posts: 9
    • View Profile
Initial position and rotation
« on: June 08, 2008, 05:15:42 pm »
Hello ever body.
i found a littel problem, this problem  occur when load model .obj or .3ds, the position and rotation is different but thy are exporting of same model, with blender.
i used this code
Code: [Select]
World worldx = new World();
        ModelFactory modelFactory = ModelFactory.getInstance();
        BaseEntity[] fields = new BaseEntity[4];
        Object3D[] cruz = null;
        if (SHOW_ORIGIN){

          /*  cruz = Loader.loadOBJ("/home/miguel/perfectday_project/TestProfectDay3D/models/xCoord.obj", "/home/miguel/perfectday_project""   /TestProfectDay3D/models/xCoord.mtl", 1.0f);*/
//              cruz = Loader.load3DS("/home/miguel/perfectday_project/TestProfectDay3D/models/xCoord.3ds", 1.0f);
            for (int i = 0; i < cruz.length; i++) {
                worldx.addObject(cruz[i]);
               
            }
        }
        worldx.buildAllObjects();
        /**
         * Place the camera at the starting position.
         */
        Camera camera = worldx.getCamera();
        camera.setPosition(this.xCamara,this.yCamara , this.zCamara);
       
        camera.lookAt(SimpleVector.ORIGIN);
         Config.fadeoutLight = false;
        worldx.getLights().setOverbrightLighting(Lights.OVERBRIGHT_LIGHTING_DISABLED);
        worldx.getLights().setRGBScale(Lights.RGB_SCALE_2X);
        worldx.setAmbientLight(25, 30, 30);

        /**
        * Place the lightsources...
        */
        worldx.addLight(new SimpleVector(0, -150, 0), 25, 22, 19);
        worldx.addLight(new SimpleVector(-1000, -150, 1000), 22, 5, 4);
        worldx.addLight(new SimpleVector(1000, -150, -1000), 4, 2, 22);
   
        return worldx;

is it normal?, if this is normal. which postion and rotation are initial with .3ds and .obj?.
Thank very much
Sorry for my english

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Initial position and rotation
« Reply #1 on: June 08, 2008, 07:52:17 pm »
The initial rotation is always the identity matrix, i.e. no rotation. The same applies to the translation: There is none. Maybe the exporter does some transformations, but the loader doesn't. i only loads what is in the file. What that is, is up to the exporter.

Offline alakat

  • byte
  • *
  • Posts: 9
    • View Profile
Re: Initial position and rotation
« Reply #2 on: June 08, 2008, 08:43:04 pm »
Yes, i thought that when o i load a model, this model dont have any translation and rotation, but in other post i paste code to i use to load,in this code i dont do any transation or rotation.
I use blender to export my model, i dont kwon why send you my model. This model is a three cylender (red cylinder paralel to X, green cylinder paralel to Y and blue cylinder paralel to Z) all there are perpendicular.
if i export model with obj, i show:

                        |Red
                        |
                        |
Green____
                       /
                      /Blue


if i export model with .3ds i show
                       |Red
                       |

                      | /Green
                      |/_______Blue

is very extrange.
Thanl very much with all help, in this extrange post
                       


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Initial position and rotation
« Reply #3 on: June 08, 2008, 09:54:31 pm »
Could be that these formats use different coordinate systems. However, if you don't like the orientation of one of them, change it after loading. The obj-version can simply be translated in the 3ds one by a simple rotation around then Y-axis.