Hi apprentice thanks so much for the help your first post pointed me in the 
right direction and I was able to get the snapping working. Didn't get to 
try your further explanation but it sounds like another good option. What I 
ended up doing was on the mouseUp of my forward or previous arrow I called a 
_snapToNearest method which basically all it did was it checked each tile's 
scene position and grabbed it's angle based on its position in relation to 
the center. Then if that angle was within the snapping limits I set I would 
simply rotate the entire thing by the difference between that angle and the 
center point. The function ended up looking somthing like the below (in case 
this ever becomes helpful to someone else other than me lol):

 private function _centerNearestPicture():void{
            
            var i:int;
            
            for ( i = 0; i < _pictures.length; i++ ){
                
                _currentPicture = _pictures[i];
                
                 // This is the angle between the current picture and the 
center point of the group.
                var $dx2:Number = _currentPicture.scenePosition.x - 
_group.scenePosition.x;
                var $dz2:Number = _currentPicture.scenePosition.z - 
_group.scenePosition.z;
                var $radians2:Number = Math.atan2($dz2, $dx2 );
                var $angle2:Number = Math.round($radians2 * 180/Math.PI);
                
                //If angle2 is between these limits then snap that picture 
to center.
                if( $angle2 > -120 && $angle2 < -60){
                    
                    _centerPicture( _currentPicture );
                    
                    break;
                    
                }
                
                
                
            }
                
            
        }
        
        private function _centerPicture($p:Plane):void{
            
            // This is the angle between the current picture and the center 
point of the group.
            var $dx2:Number = $p.scenePosition.x - _group.scenePosition.x;
            var $dz2:Number = $p.scenePosition.z - _group.scenePosition.z;
            var $radians2:Number = Math.atan2($dz2, $dx2 );
            var $angle2:Number = Math.round($radians2 * 180/Math.PI);
            
            //The difference between both angles to use for rotation 
snapping.
            var $angleDifference:Number = _ANGLE_OF_CAMERA_AND_CENTER_POINT 
- $angle2;
            
            var $currPlane:Plane;
            
            TweenMax.to(_group, .5, {onUpdate: view.render, rotationY: 
_group.rotationY - $angleDifference, ease: Expo.easeOut});
            
            var i:int;
            
            for ( i = 0; i < _pictures.length; i++ ){
                
                $currPlane = _pictures[i];
                
                TweenMax.to($currPlane, .5, {rotationY: $currPlane.rotationY 
+ $angleDifference, ease: Expo.easeOut});
                
            }
            
            _currentPicture = $p;
            
            
        }

Reply via email to