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.


Topics - 4ebureG

Pages: [1]
1
Support / Move object
« on: October 18, 2013, 07:05:43 pm »
Hello all!
I am a novice in jpct! Can you help me?
I want my object to move but it looks horrible:

 @Override
   ......
       public boolean onTouchEvent(MotionEvent me) {
       if (me.getAction() == MotionEvent.ACTION_DOWN) {     
          return true;
      }
        if (me.getAction() == MotionEvent.ACTION_UP) {
              x=me.getX();
              y=me.getY();         
       return true;
       }
         if (me.getAction() == MotionEvent.ACTION_MOVE) {           
       return true;
   }
                          try {
               Thread.sleep(15);
           } catch (Exception e) {
           }
           return super.onTouchEvent(me);
       }
            ....
              public void onDrawFrame(GL10 gl) {
      cub = new SimpleVector(Interact2D.projectCenter3D2D(fb, cube));
      if ((x!=0) && (Math.abs(cub.x-x)>5) && (Math.abs(cub.y-y)>5))
      {
      trans = new SimpleVector(Interact2D.reproject2D3DWS(world.getCamera(), fb, (int)x,(int)y));
      trans.z= cube.getCenter().z;
      cub.translate(trans);
      }
              .....
      }
Modify message

Pages: [1]