Author Topic: Android Operative System goes very slow when I rotate the camera  (Read 2154 times)

Offline CarlosMB89

  • byte
  • *
  • Posts: 15
    • View Profile
Android Operative System goes very slow when I rotate the camera
« on: December 03, 2014, 01:41:02 pm »
Hello I have a problem. I'm developing an app with a 3D view integrated into the activity. My problem is that when I move/rotate the camera the devices goes very very slow when a short time has spent.

I don`t know what causes the problem.

the code I use is the next: (I get the camera from the world world.getCamera())

public void rotate camera(moveX,moveY)
{
                         camera.moveCamera(Camera.CAMERA_MOVEIN,camDist);
   
         
         camera.rotateY((float)Math.toRadians(moveX));
         camera.rotateX((float) Math.toRadians(moveY));
         
         
         camera.moveCamera(Camera.CAMERA_MOVEOUT, camDist);
         camera.lookAt(cameraLookPosition);

}

I call this function by the main thread, when I touch the screen.

Any suggestion??
« Last Edit: December 04, 2014, 01:33:49 am by CarlosMB89 »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: Device goes very slow when I move/rotate the camera
« Reply #1 on: December 03, 2014, 08:37:27 pm »
I not sure what the screen shot is supposed to tell us nor what you mean by "device goes very very slow"!? What "goes slow"? Does the fps drop, does the movement become itself become slow or... ???

The method calls that you have posted all run at constant speed and don't depends in any way on any current state. They can't be the reason for anything becoming slow.

Offline CarlosMB89

  • byte
  • *
  • Posts: 15
    • View Profile
Re: Device goes very slow when I move/rotate the camera
« Reply #2 on: December 03, 2014, 11:45:19 pm »
Hello EgonOlsen, sorry if I didn`t explain myself so well. I mean that when I rotate the camera (I rotate it when I touch the screen) the fps goes down to 10 and the Android Operative System goes very slow, for example, the drop down Android menu goes very slow as well. It only happens when I rotate the camera. When I close the app, the system come back to normality.

I don,t know why it happens...it's like I would have a memory leak but I only rotate the camera....if I do a zoom or translation in the camera the system goes normal.

Do you know what can be the reason??

Thanks in advance

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: Device goes very slow when I move/rotate the camera
« Reply #3 on: December 03, 2014, 11:55:12 pm »
Unless this rotation causes a huge amount of objects to appear that weren't visible before, i don't see any reason for this behaviour. The calls that you've posted can't be responsible for this on their own. Does the log output tells you something?

Offline CarlosMB89

  • byte
  • *
  • Posts: 15
    • View Profile
Re: Device goes very slow when I move/rotate the camera
« Reply #4 on: December 04, 2014, 01:21:25 am »
No, the log doesn't send any message. It is very strange because only happens when I rotate the camera around 45 degrees....if I rotate the camera again to the initial position I set at the begining the app comes back to the normality :S

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: Android Operative System goes very slow when I rotate the camera
« Reply #5 on: December 04, 2014, 08:37:59 am »
I don't see why this should happen unless your scene shows a lot more objects with the camera rotated by 45. Is that the case?

BTW: Which device are we actually talking about?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: Android Operative System goes very slow when I rotate the camera
« Reply #6 on: December 04, 2014, 08:22:31 pm »
Off topic: Your email address bounces with "user unknown". I'm getting returned mails when the forum tries to send notifications to your address.

Offline CarlosMB89

  • byte
  • *
  • Posts: 15
    • View Profile
Re: Android Operative System goes very slow when I rotate the camera
« Reply #7 on: December 06, 2014, 08:26:39 am »
No my scene shows the same number of objects. Im using a nexus 10,  I tried it at other devices and the effect is lower than nexus 10  but it appear as well.:s
Maybe any other way to rotate the camera?

Sorry my email is carlos.mateo@upm.es   .....I forgot to write  the point ....

Thank you very much!!!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: Android Operative System goes very slow when I rotate the camera
« Reply #8 on: December 06, 2014, 10:17:02 am »
It has nothing to do with rotating the camera itself. Rotating the camera is a trivial operation. If the number of objects doesn't change, all i can think of is a caching issue. Are you using very large textures?

Offline CarlosMB89

  • byte
  • *
  • Posts: 15
    • View Profile
Re: Android Operative System goes very slow when I rotate the camera
« Reply #9 on: December 12, 2014, 11:44:25 pm »
No, I only use the texturized robot you can see in the image I posted in the first reply. I load it from a serialized file created by the jpct serializer plugin for eclipse. But that effect happens aswell if oone object is loaded to the scene. Do you know any solution I could try to find the problem??

Thanks in advance

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: Android Operative System goes very slow when I rotate the camera
« Reply #10 on: December 13, 2014, 08:41:16 am »
Can you provide a test case for me that shows the problem. I've never experienced anything like nor have i an idea what might cause it without seeing it for myself.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: Android Operative System goes very slow when I rotate the camera
« Reply #11 on: December 13, 2014, 11:05:58 am »
Btw: your mail address still bounces...