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 - drounal

#1
Support / visibility list
May 28, 2006, 03:59:36 PM
but why does the number of polygons on screen change that much ?

if I somehow turn the cube, I should see more or less the same number of polygons. why is it that this number keeps increasing with the number of clicks that I make (so the number of times I want the cube to move) ?
#2
Support / visibility list
May 28, 2006, 02:27:41 PM
how come, when I move a 3DS imported cube on a map using the Paradroidz MouseMapper, I get this :

WARNING: You've exceeded the configured triangle limit for the visibility list. Consider adjusting Config.maxPolysVisible!

what I want to do is move a selected cube to a given point that I click on using the mouse.  As far as I know it shouldn't change the number of polygons ...

thx in advance.
#3
Support / added some stuff ...
May 27, 2006, 12:20:48 PM
I also added a few things :
-> a method to move a selected cube:
public void moveClick(Cube pointe) {
                 
     if (cubeleft) {
         pointe.turnLeft();
     }
     if (cuberight) {
        pointe.turnRight();
     }

    Matrix backUpTrans=pointe.getTranslationMatrix().cloneMatrix();


     if (cubeforward) {
        if (speed<15) {speed+=0.1f;}
        pointe.setSpeed(speed);
        pointe.moveForward();
     }
     if (cubeback) {
        if (speed>0) {speed-=0.3f;}
        if (speed<0) {speed=0;
        }
        pointe.setSpeed(speed);
        pointe.moveForward();
     }

     if (speed>=0 && !cubeback && !cubeforward) {
        speed-=0.075f;
        if (speed<0) {speed=0;}
        pointe.setSpeed(speed);
        pointe.moveForward();
     }

     boolean ok=pointe.place(terrain);
     if (!ok) {
        pointe.setTranslationMatrix(backUpTrans);
        speed=0;
        pointe.setSpeed(speed);
     } else {}  
  }

->its call in the gameLoop function:
               moveClick(MouseMapper.click);

-> something that is supposed to affect the cube beneath the mouse in a variable when clicking:
click=(Cube) pickingObject(getMouseX(), getMouseY(), CarTest.camera, CarTest.buffer, CarTest.theWorld);

does this seem correct to u ?
I get  Exception in thread "main" java.lang.NullPointerException when compiling concerning

    Matrix backUpTrans=pointe.getTranslationMatrix().cloneMatrix();

in the mouseClick function.


.... I feel a bit lost !
#4
Support / unfortunately ...
May 27, 2006, 12:02:02 PM
unfortunately, that's what I had been doing before ...

For the moment, I started over and :
-> copied MouseMapper in my src directory (using NetBeans)
-> removed "import naroth.config.*;"
-> tried to compile
-> got "cannot find Configuration"
-> imported Configuration.java
-> removed "package naroth.config;"
-> added a function in my CarTest.java file :

   public Object3D pickingObject(int mouseX, int mouseY, Camera camera, FrameBuffer buffer, World theWorld){
  SimpleVector ray=Interact2D.reproject2D3D(camera, buffer, mouseX, mouseY);
   int[] res=Interact2D.pickPolygon(theWorld.getVisibilityList(), ray);
  if (res!=null) {
      return theWorld.getObject(Interact2D.getObjectID(res));          
  }
   return null;
   }

now it compiles, but doesn't do anything at all ... what shall I do ?
#5
Support / MouseMapper
May 27, 2006, 12:25:35 AM
Hey,
I'd like to make (and in fact I truly need for tomorrow) a MouseMapper. Here is my situation: I used the "car" example and tuned it by myself in order to create several cars instead of one (for example) or say that a given is "selected". Now I need a set of methods to be able to click somewhere in the windows and say "the car beneath my mouse is selected".

I ran through several posts that dealt with MouseMappers and got some code but I can't make it work with my own code. Help !!

L.
#6
Support / mouse controlled objects
May 18, 2006, 09:16:27 PM
thx for all your proposals. any idea concerning the number of a given cube in a cube array ? If I have the cube can I find the number easily ?
thx again and in advance
#7
Support / mouse controlled objects
May 18, 2006, 10:35:11 AM
when trying to access the camera (in the CarTest class), I get :
non-static camera cannot be referenced from a static context
how do u think I solve this ? (nothing appears to be static in the MouseMapper appart from BUTTON1 and BUTTON2)
#8
Support / mouse controlled objects
May 18, 2006, 10:02:21 AM
Oh ! one more thing.

If I have an array filled with structure "cube" on one hand and "cube" returned by the PickingObject method for example; how do I get the number of the "cube" in the array ?
(see what I mean ?)

Louis
#9
Support / mouse controlled objects
May 18, 2006, 09:49:36 AM
indeed it does, thanks a lot !

one more question by the way, using the first code u gave me. the PickingObject method returns an Object3D; how can I make it return the "Cube" object that Object3D belongs to ?
("Cube" is here made with 5 Object3D)
#10
Support / mouse controlled objects
May 17, 2006, 11:31:56 PM
Hey, another issue I need to work out.
how can I select object on the map using mouse1 (click and/or selection) and tell a given object to go where I click with mouse2 ?
thx in advance
#11
sorry for posting so many messages. besides, I found a way to work out this issue by myself.
thx again
#12
Here is the problem of the day.

I hijacked the PlantManager to create cubes instead of plants. I already found a way to create them wherever I want, but now gotta move them. To do this, I need to select them.

My guess was to use the array that is created in the manager. My "moveCube" fonction is in the CarTest file and needs to modify the cubes in the CubeManager ("Cube" replaces "Plant"). I wrote the function below to select the cubes:

  public Cube CubeSelect(int numero) {
      return cubes[numero];
  }

but I can't use it in the CarTest file. When launching the game, it crashes with:
Exception in thread "main" java.lang.NullPointerException

my function looks a bit like this:

     public void moveCube(int num) {

     if (cubeleft) {
         cubeMan.CubeSelect(num).turnLeft();
     }
     if (cuberight) {
        cubeMan.CubeSelect(num).turnRight();
     }

where cubeleft and cuberight are event. the problem comes from the "cubeMan. ..."

Any idea ?

thx in advance
#13
Support / keymapper issue
May 16, 2006, 08:55:04 PM
thank u very much for the tip !
++
#14
Support / free camera
May 16, 2006, 08:54:37 PM
thx, it works fine !
++
#15
Support / keymapper issue
May 16, 2006, 07:14:56 PM
I used the keymapper function given in the car example to perform several actions during the game. for example, I made it possible to build a cube when pressing key 'c' but each time two cubes are built: it seems like one is added when pressing the key and the other one when releasing the key. How can I change this ?
thx in advance.