Android Operative System goes very slow when I rotate the camera

Started by CarlosMB89, December 03, 2014, 01:41:02 PM

Previous topic - Next topic

CarlosMB89

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??

EgonOlsen

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.

CarlosMB89

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

EgonOlsen

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?

CarlosMB89

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

EgonOlsen

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?

EgonOlsen

Off topic: Your email address bounces with "user unknown". I'm getting returned mails when the forum tries to send notifications to your address.

CarlosMB89

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!!!

EgonOlsen

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?

CarlosMB89

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

EgonOlsen

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.

EgonOlsen