Panoramas on MT? 
Posted: 28 August 2008 11:08 AM   [ Ignore ]
Jr. Member
RankRank
Total Posts:  132
Joined  2008-03-11

Hi all

Anyone know of anyone who has successfully used a panorama viewer on their surface?

I’m trying to do it with PapervisionQTVR and Touchlib/TUIO.

Seems there is more to it than meets the eye where dragging and rotating is concerned in 3D. I might have to ask some guy called Ray Casting smile

 Signature 

~ myHead.addEventListener(Event.ENTER_FRAME, functionProperly); ~

Profile
 
 
Posted: 28 August 2008 12:31 PM   [ Ignore ]   [ # 1 ]
Jr. Member
RankRank
Total Posts:  132
Joined  2008-03-11

Or…

If I can get the coordinates of a single blob and pass them as a number to replace mouseX & mouseY it should work.

Any ideas? I have extended my class with RotatableScalable and set noMove, noRotate and noScale to true. This might seem silly but the panorama is an image on a 3D sphere with a camera inside it, so I dont want to rotate it or scale it or even drag it (not in the conventional sense at least).
The end result is achieved by measuring the distance dragged across the stage then translating this to camera rotation.

I have looked through RotatableScalable and tried to find a number or variable I can pass to my functions but I’m stuck now to be honest.

It will look cool when it works wink

 Signature 

~ myHead.addEventListener(Event.ENTER_FRAME, functionProperly); ~

Profile
 
 
Posted: 29 August 2008 12:42 PM   [ Ignore ]   [ # 2 ]
Jr. Member
RankRank
Total Posts:  132
Joined  2008-03-11

So after a lot of trying things out I found that “myOrigX and myOrigY” return a co-ordinate as do “origX & origY” but I still can’t get it to work quite right. I can get some rotation but only in one direction.

If I can convert any number less than 500 to a negative integer, and likewise any number above 500 to a positive integer, I can crete 2-way rotation.
Can anyone help with that?

Thanks in advance.

 Signature 

~ myHead.addEventListener(Event.ENTER_FRAME, functionProperly); ~

Profile
 
 
Posted: 29 August 2008 02:09 PM   [ Ignore ]   [ # 3 ]
Jr. Member
Avatar
RankRank
Total Posts:  103
Joined  2008-06-26

Gordee,

if you are running on OSX, this should not be a problem at all. You could simply use the TUIOpatch for Quartz Composer and send the data to the mouse patch. Getting a QTVR in QC is then quite easy.

Greets,

 Signature 

Sandor Rozsa
--
corporate design cologne
http://www.cd-cologne.de

Profile
 
 
Posted: 29 August 2008 02:37 PM   [ Ignore ]   [ # 4 ]
Jr. Member
RankRank
Total Posts:  132
Joined  2008-03-11

sandor,

thanks for the reply. Unfortunately I am on Windows XP :(

 Signature 

~ myHead.addEventListener(Event.ENTER_FRAME, functionProperly); ~

Profile
 
 
Posted: 30 August 2008 07:47 AM   [ Ignore ]   [ # 5 ]
Jr. Member
RankRank
Total Posts:  132
Joined  2008-03-11

Actually this is a re-occurring problem now. Basically when trying to adapt simple apps for use on a surface, the simple solution seemingly would be to import the TUIO classes, init TUIO, change the mouse events to TouchEvents and compile.

This does work if you’re just pressing buttons, but if you want to drag, or do anything that normally involves mouseX,mouseY values it doesn’t work.

For instance, the well known page flip books. In my opinion they would look cool on a table. The problem is, because the mouse is not involved the software is not looking for a blob and therefore doesn’t work as expected. It will respond to a click if the mouse is in the same spot though. Maybe tricking flash into thinking the blob is the mouse will work -

blobs[0] = mouseX,mouseY; or something?

Does anyone have any good ideas to workaround this without re-writing everything?

 Signature 

~ myHead.addEventListener(Event.ENTER_FRAME, functionProperly); ~

Profile
 
 
Posted: 30 August 2008 01:42 PM   [ Ignore ]   [ # 6 ]
New Member
Avatar
Rank
Total Posts:  55
Joined  2007-12-08

Try mapping the TouchEvent class in the TUIO package over to the MouseEvent.  You can do this by extending whatever object is listening for the MouseEvent and adding a listener for the TouchEvent.  In your case the book is probably listening for a MouseDown, MouseMove and a MouseUp event so you would add something like this to the object:

//Add Event Listeners
        this.addEventListener(TouchEvent.MOUSE_DOWNdispatchMouseDownEvent);
        
this.addEventListener(TouchEvent.MOUSE_UPdispatchMouseUpEvent);
        
this.addEventListener(TouchEvent.MOUSE_MOVEdispatchMouseMoveEvent);        

//Handle the Touch Event
         
protected function dispatchMouseDownEvent(event:TouchEvent):void
        {
            
var click:MouseEvent = new MouseEvent(MouseEvent.MOUSE_DOWNtruefalseevent.localXevent.localYthis);
            
dispatchEvent(click);
        
}
        
        
protected function dispatchMouseUpEvent(event:TouchEvent):void
        {
            
var click:MouseEvent = new MouseEvent(MouseEvent.MOUSE_UPtruefalseevent.localXevent.localYthis);
            
dispatchEvent(click);
        
}
        
        
protected function dispatchMouseMoveEvent(event:TouchEvent):void
        {
            
var click:MouseEvent = new MouseEvent(MouseEvent.MOUSE_MOVEtruefalseevent.localXevent.localYthis);
            
dispatchEvent(click);
        
}

Profile
 
 
Posted: 30 August 2008 02:48 PM   [ Ignore ]   [ # 7 ]
Jr. Member
RankRank
Total Posts:  132
Joined  2008-03-11

Thanks Matt I tried that and it worked perfectly for the Panorama.

With the book it is a little more complex as it uses the floating position of the mouse to animate the page corner lifting when you mouse over it.

private function getCursorPosition():int {
            
var ret:int CURSOR_NOWHERE;
            
            
// Check if the cursor is over the _pages at all
            
if (_mz.mouseX && _mz.mouseX _mz.pageWidth &&
                
_mz.mouseY && _mz.mouseY _mz.pageHeight)
            
{
                
                
// Top of bottom
                
if (_mz.mouseY _dragRange{
                    
// Top
                    
ret |= CURSOR_TOP;
                
else if (_mz.mouseY _mz.pageHeight _dragRange{
                    
// Bottom
                    
ret |= CURSOR_BOTTOM;
                
}
                
                
// Left or right
                
if (_mz.mouseX _dragRange{
                    
// Left
                    
ret |= CURSOR_LEFT;
                
else if (_mz.mouseX _mz.pageWidth _dragRange{
                    
// Right
                    
ret |= CURSOR_RIGHT;
                
}
                
            }
            
            
return ret;
        
}

I am considering taking this function out but I’m sure it will break!

I am really greatful for your advice smile

 Signature 

~ myHead.addEventListener(Event.ENTER_FRAME, functionProperly); ~

Profile