Hi,
I've read the posts about picking, but i can't get the picking to work properly.
In onChangeSurface i add a cube (like in HelloWorld)
cube = Primitives.getCube(10);
cube.calcTextureWrapSpherical();
cube.setTexture("texture");
//cube.translate(0, 0, 0);
cube.strip();
cube.build();
cube.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
world.addObject(cube);
In onTouchEvent i am trying to rotate this cube when picked using the code mentioned in almost all topics
public boolean onTouchEvent(MotionEvent me) {
xpos = me.getX();
ypos = me.getY();
SimpleVector dir=Interact2D.reproject2D3DWS(world.getCamera(), fb, (int)xpos, (int)ypos).normalize();
Logger.log("touch: x" + xpos + " y"+ypos);
Object[] res=world.calcMinDistanceAndObject3D(world.getCamera().getPosition(), dir, 100000);
Logger.log(""+res[0]);
if(res[1] != null)
{
Logger.log("picked");
Object3D obj = (Object3D) res[1];
obj.rotateX(50);
}
I tried to edit the ignoreIfLarger parameter and collideOffset - Not a significant difference
Problem: The bottom half of visible part of the cube is unpickable (it doesnt response to touches) and it responses even to touches above the cube.
Has anyoned faced this problem or see the solution?
Im using SE X10 mini