Simple but effective. I changed the order of rotations and it did the trick.
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[code]
cam.rotateCameraX((tilt+90)*rad2bogFac);
cam.rotateCameraY(yaw*rad2bogFac);
[/code]
float sc = cube.getScale();
// fix scaling
cube.setScale(1f);
Matrix rotMat = cube.getRotationMatrix();
Matrix rotToMat = new Matrix();
// degree to radian
rotToMat.rotateX(rotAim[0] * rad);
rotToMat.rotateY(rotAim[1] * rad);
// factor calculated from the click time
float f = Math.min(1,(float) (time (startAiming)/450) );
rotMat.interpolate(rotMat, rotToMat,f );
cube.setRotationMatrix(rotMat);
cube.setScale( (sc*11 + 4f) /12 );
cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 22);
cam.lookAt(cube.getTransformedCenter());
// tried this to fix it but it didn't
cam.setEllipsoidMode(Camera.ELLIPSOID_ALIGNED);
// code at touch event
SimpleVector dir = Interact2D.reproject2D3DWS(world.getCamera(), fb, Math.round(me.getX()) , Math.round(me.getY())) .normalize();
Object[] res=world.calcMinDistanceAndObject3D(world.getCamera().getPosition(), dir, 10000 /*or whatever*/);
float f = world.calcMinDistance(world.getCamera().getPosition(), dir, 1000);
if (f != Object3D.COLLISION_NONE ){
Object3D picked = (Object3D)res[1];
TextView tv = (TextView) findViewById(R.id.textHit);
String nam = picked.getName();
tv.setText( nam);
int idx = indexOf ( nam, colorNames);
if (idx>-1){
rotAim = rotAims[idx];
cube.clearRotation();
cube.rotateX(rotAim[0] * rad );
cube.rotateY(rotAim[1] * rad );
}
}
Page created in 0.021 seconds with 11 queries.