www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: alakat on June 08, 2008, 05:15:42 pm

Title: Initial position and rotation
Post by: alakat 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
Title: Re: Initial position and rotation
Post by: EgonOlsen 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.
Title: Re: Initial position and rotation
Post by: alakat 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
                       

Title: Re: Initial position and rotation
Post by: EgonOlsen 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.