Author Topic: Mouse Mapper  (Read 10323 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Mouse Mapper
« Reply #15 on: June 04, 2007, 01:48:40 pm »
Init the MouseMapper, call mouse.hide() on it. Do both things ONE time, not multiple times in the loop.
Call move() in the loop. Should work.

Offline san14

  • int
  • **
  • Posts: 60
    • View Profile
Re: Mouse Mapper
« Reply #16 on: June 05, 2007, 08:17:50 am »
Hi EgonOlsen
     
        Is it what I need to do As
       private void initMouseMapper(){
                            mouse.hide();
     
              }
              private void gameLoop() throws Exception {
                            move();
             }
       
       



         Is some thing else to be done in initMouseMapper(). As i tried with this and could not do.


With Regards
San14


San14

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Mouse Mapper
« Reply #17 on: June 05, 2007, 08:33:49 am »
Looks fine so far. Maybe you application does something else with the camera that makes the call to move() useless. Look at move() and adept what it does to your case. I don't know what you are doing exactly, so this example is for manipulating the camera as if no other code would do it. If it does, you have to adjust that behaviour.

Offline san14

  • int
  • **
  • Posts: 60
    • View Profile
Re: Mouse Mapper
« Reply #18 on: June 13, 2007, 11:27:40 am »
HI EgonOlsen

     The mouse code is working fine. I have tried to put forward movement as
                 
            float speedForMouse=3;

             if (mouse.buttonDown(0)) {
                      SimpleVector s=camera.getDirection();
                theWorld.checkCameraCollisionEllipsoid(s, UP_MOVEMENT, 2, 2);              
              }

             
            And is Working fine
           How do I do same for Right Click of Mouse


With Regards
san14
« Last Edit: June 13, 2007, 11:46:45 am by san14 »
San14

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Mouse Mapper
« Reply #19 on: June 13, 2007, 12:14:15 pm »
mouse.buttonDown(1) ?

Offline san14

  • int
  • **
  • Posts: 60
    • View Profile
Re: Mouse Mapper
« Reply #20 on: June 13, 2007, 12:39:31 pm »
Thanks EgonOlsen
     
        It worked.  :D

With Regards
San14
San14

Offline san14

  • int
  • **
  • Posts: 60
    • View Profile
Re: Mouse Mapper
« Reply #21 on: July 11, 2007, 12:22:47 pm »
HI
    I am able to move in environment using mouse. I want to move in front and back , even if i am seeing at roof..etc.

   Means Player should not leave the floor while seeing roof and walking ahead.
   This is the code for normal movement. Can some one help me out with it.


 if (mouse.buttonDown(0)) {              
         SimpleVector s=camera.getDirection(); 
         theWorld.checkCameraCollisionEllipsoid(s, UP_MOVEMENT, 2, 2);
     }

 if (mouse.buttonDown(1)) {              
           SimpleVector s=camera.getDirection();
         theWorld.checkCameraCollisionEllipsoid(s, UP_MOVEMENT, -2, 2);
    }



With Regards
San14
San14

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Mouse Mapper
« Reply #22 on: July 11, 2007, 02:35:17 pm »
The fps-example as well as the advanced example are doing this. The basic idea is, to keep track of the rotations in the X-Z-plane (i.e. around the y-axis) in the seperate matrix instead of only turning the camera. You have to modify the rotations for x-mouse-movement (dx<0; dx>0) in a way that you add a <your-tracking-matrix>.rotateY(angle);. Then you can use this matrix instead of the camera's so that SimpleVector s=camera.getDirection(); becomes something like SimpleVector s=<your-tracking-matrix>.getZAxis();
As said: Both examples contain similar code. In fact, this thread contains similar code (taken from the advanced example) in the earlier posts.

Offline san14

  • int
  • **
  • Posts: 60
    • View Profile
Re: Mouse Mapper
« Reply #23 on: August 08, 2007, 12:46:09 pm »
Hi EgonOlsen

      I looked for movements in Advance example but could not make out. But I am able to achive the movements using this code. But the problem is that When I take turn the user. The user forgets the direction and moves in other direction.


  if (mouse.buttonDown(0)) { 
             SimpleVector s=camera.getDirection();
           SimpleVector ss=new Matrix().getZAxis();
                   theWorld.checkCameraCollisionEllipsoid(ss, UP_MOVEMENT, 2, 2);

       
     }
    if (mouse.buttonDown(1)) {              
           SimpleVector s=camera.getDirection();
           SimpleVector ss=new Matrix().getZAxis();
                   theWorld.checkCameraCollisionEllipsoid(ss, UP_MOVEMENT, -2, 2);
     }



Can suggest how to go about this


With Regards
San14
« Last Edit: August 08, 2007, 04:03:28 pm by san14 »
San14

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Mouse Mapper
« Reply #24 on: August 08, 2007, 07:04:54 pm »
That code makes no sense. It's a very complicated of saying: Just move along the z-axis. Instead of instantiating the Matrix for ss everytime, do it once and apply the rotations of the user to it, i.e. you are now doing a cam.rotateAxis(com.getYAxis(), ang) or something similar. You simply add (not replace) a <your_matrix>.rotateY(ang); and use that <your_matrix> to derive your ss from it.

Offline san14

  • int
  • **
  • Posts: 60
    • View Profile
Re: Mouse Mapper
« Reply #25 on: August 09, 2007, 03:15:39 pm »
Hi EgonOlsen
   
       Please can you tell me, which portion or file implements this kind of mouse movement in Advance Example.


With Regards
San14
San14

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Mouse Mapper
« Reply #26 on: August 09, 2007, 03:57:53 pm »
Sure. That's feud.testgame.model.LocalPlayerObject