www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: Mr_Chaos on August 14, 2014, 02:37:20 pm

Title: MultiTouch android control sample code
Post by: Mr_Chaos on August 14, 2014, 02:37:20 pm
I've finally gotten the source code for a simple MotionEvent handler posted.

I'll try to make some code to show it off later.

http://www.jpct.net/wiki/index.php/MultiTouch_camera_controls (http://www.jpct.net/wiki/index.php/MultiTouch_camera_controls)
Title: Re: MultiTouch android control sample code
Post by: EgonOlsen on August 19, 2014, 10:49:33 am
Thanks for sharing.
Title: Re: MultiTouch android control sample code
Post by: Mr_Chaos on September 10, 2014, 09:01:15 pm
Updated with the actual camera movement code from the Activity
Title: Re: MultiTouch android control sample code
Post by: aeroxr1 on September 22, 2014, 06:51:46 pm
Hi.
I'm using this jpct camera system but I have a problem : when I rotate the display from portrait to landscape the camera is too much zoomed. Then I use android.view.Display.getRotation() to get the orientation of the device, but which are the values to change inside the MovementHandler for a correct camera position ?

I suppose that I have to set FOV, right ?

Title: Re: MultiTouch android control sample code
Post by: EgonOlsen on September 22, 2014, 08:28:05 pm
The fov that you are setting is the horizontal fov, the vertical fov adjusts accordingly to avoid image distortion. This will of course change the size of the objects. You can adjust the fov after the rotation to compensate for this effect if you want to.
Title: Re: MultiTouch android control sample code
Post by: aeroxr1 on September 22, 2014, 08:52:57 pm
On my scene I have an animated3d object and I would to set my camera so my object is all in the display .
Now the situation is :
(http://imagizer.imageshack.us/v2/280x200q90/905/rKWUOw.png) (http://imageshack.com/f/p5rKWUOwp)
(http://imagizer.imageshack.us/v2/280x200q90/673/SRlMFs.png) (http://imageshack.com/f/ipSRlMFsp)

How can I adapt the horizontal fov to obtain a correctly object view in landscape ?

Which are the other options ? Scale Object and moveout the camera ? But I would adapt the camera depending from the display resolution ..
Title: Re: MultiTouch android control sample code
Post by: aeroxr1 on September 23, 2014, 10:36:00 am
This is what I have to do :

Code: [Select]
cameraDistance = ( modelHeight / 2 ) / tan( fovy / 2 )
Then place your camera:
cameraPos.z = modelPos.z - cameraDistance

 but in Mr_Chaos code I don't find something like that.. And I don't know how have to do to merge this math function with Mr_Chaos's code..

Mr_chaos's can you help me ? :)
Title: Re: MultiTouch android control sample code
Post by: EgonOlsen on September 23, 2014, 01:58:31 pm
I'm not sure what exactly you are asking for...you know that you have to adjust the fov, you have some code that does this and you want to integrate it into...what exactly? And why doesn't it work? If this is all about moving the camera away from the model, then why just not do it? If it's about adjusting the fov, then why just not do it? I'm not sure what the actual problem is... ???
Title: Re: MultiTouch android control sample code
Post by: aeroxr1 on September 23, 2014, 03:19:47 pm
Because I have used Mr_Chaos's code and it doesn't auto-adjust the fov and distance when the smartphone rotate from portrait to landscape ;)
But sadly I can't to edit the Mr_chaos's code because I can't see where he sets the camera distance ..
But I want to use his code  because is wonderfull ;) infact it handles the android multitouch , pinch-to-zoom and camera's rotation !

It's not easy for me to edit the code's of someonelse

edit : maybe I understand where I have to put the new code.. :D
Title: Re: MultiTouch android control sample code
Post by: Mr_Chaos on September 24, 2014, 10:07:02 pm
Because I have used Mr_Chaos's code and it doesn't auto-adjust the fov and distance when the smartphone rotate from portrait to landscape ;)
But sadly I can't to edit the Mr_chaos's code because I can't see where he sets the camera distance ..
But I want to use his code  because is wonderfull ;) infact it handles the android multitouch , pinch-to-zoom and camera's rotation !

It's not easy for me to edit the code's of someonelse

edit : maybe I understand where I have to put the new code.. :D

The MovementHandler on handles movement, rotating the display you need to handle youself.