Open GoogleCodeExporter opened 9 years ago
Hello dude I solve that question chek:
@Override
public boolean onTouchEvent(MotionEvent event){
if (event.getAction() == MotionEvent.ACTION_DOWN)
{
touchedX = event.getX();
touchedY = event.getY();
} else if (event.getAction() == MotionEvent.ACTION_MOVE)
{
objModel.rotation().z -= (touchedX - event.getX())/2f;
objModel.rotation().x -= (touchedY - event.getY())/2f;
try {
float ok=spacing(event);
planePosition += (event.getY() - touchedY) * 0.01f;
if(planePosition <= maxScal){
objModel.scale().x = objModel.scale().y = objModel.scale().z = planePosition;
}else{
objModel.scale().x = objModel.scale().y = objModel.scale().z = 1f;
}
if(planePosition >= minScal){
objModel.scale().x = objModel.scale().y = objModel.scale().z = planePosition;
}else{
System.out.println("Se ha salido del rango");
objModel.scale().x = objModel.scale().y = objModel.scale().z = .1f;
}
} catch (Exception e) {
}
touchedX = event.getX();
touchedY = event.getY();
}
return true;
}
private float spacing(MotionEvent event) {
float x = event.getX(0) - event.getX(1);
float y = event.getY(0) - event.getY(1);
return FloatMath.sqrt(x * x + y * y);
}
In other class where you call RenderActivity.java you need to put this code and
it works for me very well.
Original comment by Armando....@gmail.com
on 1 May 2013 at 6:14
Thanks for u answer!:)But i want to know the value of maxScal and minScal what
u set.Now I set maxScal =20,minScal =10.
Original comment by anarki1...@gmail.com
on 15 May 2013 at 10:01
Hi , me i need to rotate more object in same time ,but not on its own axis, but
if you have 3 items to revolve around an axis, for example the middle of those
three items, can someone help me?
Original comment by braniste...@gmail.com
on 25 Feb 2014 at 5:43
Original issue reported on code.google.com by
chenlire...@gmail.com
on 10 Apr 2013 at 3:37