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

#1
Hm!
Problem is solved, thanks to everybody

//correct
class X extends activity  {

myGLView.setOnTouchListener(new View.OnTouchListener() {
}

}

//wrong
class X extends activity  {

@Oeverride
public boolean onTouch() {
}

}



:)
#2
I use this

setOnTouchListener(new View.OnTouchListener() {
    public boolean onTouch(View v, MotionEvent e) {

           switch(e.getAction()) {
               case ACTION_MOVE:
                   xMouse = e.getX();
                   yMose = e.getY();
               break;
           }

       return true;
    }
});


Maybe i should override? ->
@Override  public boolean onTouchEvent
#3
Hm!
I still have problems, this example work fine on desktop systems, but on android system emulator it's work not exactly, differences in the mouse coordinates..
Problems with movements,  object does not move exactly (always a distance) when you mouse click.
I don't undesrtand why.
#4
Thanks EgonOlsen!
It's work 100% very well..

Thanks again...

#5
So the solutins is?
SimpleVector mouse3D = Interract2D.reproject2D3DWS(camera, xMouse, yMose).normalize(); // Am correctly use  method to convert 2D mouse coordinates from screen to 3D?
float angel = mouse3D.calcAngel(my3Dobject);
my3Dobject.clerRotation();
my3Dobject.rotaY(Math.toRadian(angel));

i always got positive angel...
#6
Hallo!

I want to solve the following problems:
1) How to rotateY() 3D object in world space by 2D mouse coordinates? // 3D object must follow mouse movements
2) How to move 3D object in world space by 2D mouse cooridnates? // 3D object must move in world by mouse click

//Solution 1
SimpleVector mouse3D = Interract2D.reproject2D3DWS(camera, xMouse, yMose).normalize();
float angel = mouse3D.calcAngel(my3Dobject);
my3Dobject.clerRotation();
my3Dobject.rotaYAxis(new SimpleVector(0,1,0), angel);

//Solution 2
SimpleVector mouse3D = Interract2D.reproject2D3DWS(camera, xMouse, yMose).normalize();
Simple direction = mouse3D.calcSub(my3Dobject.getTranslation()); // get direction of 3Dobject
my3Dobject.translate(direction.x+1, 0, direction.z+1);

Maybe similar topics already exist? (please can send the links)

Sorry for my english.

Thanks!


[attachment deleted by admin]