Hi, my app have 2 object.
The object2 is a child of object1.
At the first time run app. I click on child and call translate, it go on the correct direction that i that my finger move.
After I rotate the parent, it go on the opposite way with my finger.
I only want the child move along with it out Axis, not in work Axis.
in pic1 it correct, in pic2 it wrong direction.
here is my code:
public void onDrawFrame(GL10 gl) {
SimpleVector dir = Interact2D.reproject2D3DWS(cam, fragment3D.fb, (int) fragment3D.xPos, (int)fragment3D.yPos).normalize();
world.calcMinDistanceAndObject3D(world.getCamera().getPosition(), dir, 10000F);
if (this.hasToCreateBuffer) {
hasToCreateBuffer = false;
fb = new FrameBuffer(w, h);
}
if (object2.wasTargetOfLastCollision()){
SimpleVector direction = new SimpleVector(dis*scale,0,0);
object1.translate(direction);
}else{
if (touchTurn != 0) {
object1.rotateY(touchTurn);
touchTurn = 0;
}
if (touchTurnUp != 0) {
object1.rotateX(touchTurnUp);
touchTurnUp = 0;
}
}
updateFrame();
}