Main Menu
Menu

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.

Show posts Menu

Messages - manumoi

#121
Support / still not working
June 01, 2005, 11:08:31 PM
It must be something simple but it still doesn't work. Here is my code :

// used to init a model
public void loadModel(){
   model=Loader.loadMD2(PATH+SEP+"models"+SEP+"scarlet"+SEP+"tris.md2", 0.5f);
   model.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
   TextureManager.getInstance().addTexture("alita2", new Texture(PATH+SEP+"models"+SEP+"scarlet"+SEP+"scarlet_dress_red.jpg"));
   model.setTexture("alita2");
   model.rotateY(5f); // not the correct angle... just to see if it works
   model.rotateMesh();
   model.build();
   model.setRotationMatrix(new Matrix());
   placeModel(model);
   theWorld.addObject(model);
   }


// used to place the model in the world (at initialization and in the game loop)
public void placeModel(Object3D model){
   SimpleVector dropDown = new SimpleVector(0,1,0);   
   Matrix rotMat = model.getRotationMatrix();
   rotMat.setIdentity();
   float distanceToGround = terrain.calcMinDistance(model.getTransformedCenter(), dropDown, 4*30);
    model.translate(0,-20,0);
   if (distanceToGround!= Object3D.COLLISION_NONE)
       distanceToGround -=10;
   dropDown.scalarMul(distanceToGround-4);
   model.translate(dropDown);
   model.rotateY(yRot);
   }



and here is a picture of the interface



My camera is well placed and follow the model when it is moving. I would like to rotate my model in order that I see its back (so I need to rotate it around the Y axis) and without interfering with axis.

I tested it with different md2 models... and all of them are looking on the right..

Do you see where my mistake is?

Thanks you

Manu