Full auto-orient via expression

Hi!
I'd like a 3D Null to get the orientation of 3D a layer. (without parenting, it would be too easy )
I've tried a lot of solutions, through orientation, rotations, both combined... some results are close, but never perfect.
If I'm right, orientation is computed before rotations...
I think the simplest way would be with auto-orientation, or the lookAt() expression on orientation, wich gives me correct X and Y orientations, and then get an expression on zRotation to get a "full" orientation.
But what would it be?
How can I get the Z orientation in layer space?
Any idea will be appreciated!
François

So here's what I tried:
- scale expression
  var layer = thisComp.layer(  /* name of the parent layer */  );
  var scl = [1, 1, 1];
  while (layer != null)
    for (var j=0; j<3; j++)
      scl[j] *= layer.scale[j]/100;
    try
      layer = layer.parent;
    catch (err)
      layer = null;
  scl*100;
- orientation expression
  function sign(x)
    return x>=0  ?  1 : -1;
  function getOrientation(u, v, w)
      // still the same thing
  layer = thisComp.layer(  /* name of the parent layer */  );
  u = layer.toWorldVec([1,0,0])*sign(scale[0]);
  v = layer.toWorldVec([0,1,0])*sign(scale[1]);
  w = layer.toWorldVec([0,0,1])*sign(scale[2]);
  getOrientation(u, v, w);
I haven't tested it that much but the idea seems fine to me. In the scale expression note that I start the loop from the parent layer because in my case I want my parented layer to have the exact same scale.

Similar Messages

  • Adobe air 3.4 + auto orient

    I'm having trouble with getting the app I'm creating (using Flash professional CS6) to auto orient reliably.  if the app is moved from portrait to landscape, it works fine.  when moved back from landscape to portrait, then the screen items do not move to the desired spots.  within each of the "if" statements I also have commands for setting where screen items within the milApp movie clip are to appear.  Any help is greatly appreciated.
    //function to set the stage orientation for the app;
    function orientMilApp(event:Event):void
        var device_width:int = appStage.stageWidth;
        var device_height:int = appStage.stageHeight;
        if (device_width > device_height)
            milApp.gotoAndStop("landscape");
            //set the height, width, and position of the cheat sheet;
            milApp.cheatSheet_mc.x = 0;
            milApp.cheatSheet_mc.y = 100;
            milApp.cheatSheet_mc.height = 1657.25;
            milApp.cheatSheet_mc.width = 1280;
            milApp.closeButton_btn.x = 1200;
            milApp.closeButton_btn.y = 101;
            //set the dimensions and position of screen items for the driver manual
            //set the dimensions and position of screen items for the reference manual
          } else {
            milApp.gotoAndStop("portrait");
            milApp.closeButton_btn.x = 720;
            milApp.closeButton_btn.y = 101;
            //set the height, width, and position of the cheat sheet;
            milApp.cheatSheet_mc.x = 0;
            milApp.cheatSheet_mc.y = 100;
            milApp.cheatSheet_mc.width = 800;
            milApp.cheatSheet_mc.height = 1035.80;
            //set the dimensions and screen items of the driver manual
            //set the dimensions and screen items of the reference manual
    appStage.addEventListener (StageOrientationEvent.ORIENTATION_CHANGE, orientMilApp);

    Having not known the devices you want this to be on, I'd go back to simply measuring the devices resolution width versus height and translate that into landscape or portrait. All you calculations should be based on the returned resolutions for placement of items. It will require somewhat of a layout engine and for you to clearly mark what device resolutions you support.
    For instance it's pretty easy to handle Apple because you're really only dealing with 1024x768 or 2046x1536 and portrait is DEFAULT. However if you're just measuring device width and height, you'll still get the same result, portrait, from your measurements.
    Android is really rough but gives you more granular control over the minimum and maximum size and resolution of the device. You can clearly mark in your apps android settings that you only support say, 7"-10" devices with a resolution of a certain size (marked as ldpi, mdpi, hdpi, xhdpi). For more info and what all those settings mean, read here: http://developer.android.com/guide/practices/screens_support.html
    xlarge screens are at least 960dp x 720dp
    large screens are at least 640dp x 480dp
    normal screens are at least 470dp x 320dp
    small screens are at least 426dp x 320dp
    Staying inside xlarge keeps you in the 7-10" safe range for a larger tablet like the Galaxy.

  • HT4437 Can I play a video from the remote app onto apple tv whilst simultaneously stra,ing music to other speakers via express?

    Can I play a video from the remote app onto apple tv whilst simultaneously stra,ing music to other speakers via express?

    Thank you for that, I wanted to make sure I was trying to replicate the same thing as you. Just tried it now, works fine for me.
    Of note though, this will take a relatively well performing network to achieve this, I have such a network, if your network is not as good as it might be, you might encounter problems.
    For the avoidance of doubt, I used the remote app on my phone to get my iTunes library on my computer to stream music to 3 of my Apple TVs, I then used the remote app to control another Apple TV and get it to stream a music video from my computer to it. Of interest I managed to do this while my wife was using yet another Apple TV (not with the remote app) to watch something else from iTunes on my computer.

  • Aspect ratio: Auto vs. Auto orientation

    What is the difference between the settings "Aspect ratio = auto" and "Auto orientation = true"?
    -Aaron

    The aspect ratio setting of portrait, landscape, or auto, controls what orientation the app opens up in. Most times you would choose portrait or landscape, but in doing so you’re saying that the app only uses that ratio. If you have an app that is both portrait and landscape, then auto might make sense. You would also want to include all of the possible splash screens, not just the portrait or landscape ones.
    Auto orient controls whether the app will rotate around when the user turns the device 90 or 180 degrees. For iOS apps you would most likely want that to be on, because it’s a requirement for the iTunes store. But, as an alternative you can have it set to be off, then change that at runtime to be on at the right times. One example use case would be if part of the game play involves using the accelerometer, you wouldn’t want the screen to rotate on the user while playing that part of the game.

  • Flex mobile orientation: force portrait mode and then allow auto orientation

    I'm creating a flex mobile project and I want to force the app to portrait orientation when I click a button, and when I click other button allow again to change the orientation.
    This is my code when I click the first button, where I want to force portrait mode:
    protected function click(event:MouseEvent):void{      if(stage.orientation != StageOrientation.DEFAULT){           stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, orientationChanged);           stage.setOrientation(StageOrientation.DEFAULT);      }else{           doSomething();      }  }  
    private function orientationChanged(event:StageOrientationEvent):void{      doSomething();      stage.removeEventListener(StageOrientationEvent.ORIENTATION_CHANGE, orientationChanged); } 
    private function doSomething():void{      stage.autoOrients = false; }
    It works ok and it changes the orientation if it's needed.
    Now, when I want to allow orientation change again, I've only putted:
    stage.autoOrients = true;
    It works ok if when I click the first button the app is in portrait and it doesn't have to change anything. But if it's on landscape and it have to change to portrait, when I allow orientation change again, it doesn't work ok.
    Do you know if I have to allow or change something? Or, is there any better way to do this?
    Thanks in advance

    Thanks for your answer. It works, but I have the same problem that I have setting the orientation. If I'm on landscape, it changes to Portrait ok, but when I want to allow auto orientation again, it doesn't work well.
    A little tricky I've found is:
    When I want to force to portrait:
    private var oldOrientation:String = null;
    protected function click(event:MouseEvent):void{
       if(stage.orientation != StageOrientation.DEFAULT){
                oldOrientation = stage.orientation;
                stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, orientationChanged);
                stage.setOrientation(StageOrientation.DEFAULT);
       }else{
                doSomething();
    private function orientationChanged(event:StageOrientationEvent):void{
                // do something if you are changing to portrait mode (the first change) and other thing if you are changing to old orientation
    And when I want to allow auto orientation again:
    if(oldOrientation != null){
            stage.setOrientation(oldOrientation);
            oldOrientation = null;             

  • Auto Orientation

    Hi;
    I'm trying to learn flash builder. Making a simple application used tab views.
    I  designed the page, but when I switch orientation, some objects not seen
    on a screen.
    How can I adding auto orientation to my application.
    peace

    Hi,
      This is the FormCentral forum, You may want to check the Acrobat forum: http://forums.adobe.com/community/acrobat
    I believe the orientation that you initially scanned in your pages will be the orientation saved in the PDF file.  Now, you will need Acrobat to manually rotate the specific-page-orientation.  Depending on which version of Acrobat you have, you should be able to either change the view of a page by selecting 'View/Rotate' or  'Documents/Rotate Pages'.  Acrobat will not rotate it for you automatically after scanning.
    Thanks,
    Lucia

  • Disable Auto Orientation only in a specific frame!

    Hi there! 
    I appreciate if you please guide me with your experience in Mobile App design.
    My App contains 5 frames of data (movieclips), that each frame has 2 designs:
    1- Stand mode design    (portrait)
    2- Wide mode design     (landscape)
    So far it works great and I have published my App both on Google Play and Apple Store.
    Frames structure is as follows:
    frame   1            Loads External Data
    frames 2-6         Each frame contains 1 MovieClip designed based on mobile "Stand mode"
    frames 22-26     Each frame contains 1 MovieClip designed based on mobile "Wide mode"
    (Example: contents of frame 2 and 22 are the same, also 3 & 23 ... 6 & 26)
    (frame 2 is STAND design, 22 is WIDE design, and so on)
    In "Air Setting Dialoge", I have selected aspect ratio "Auto" and "Auto orientation".
    And I have this code in Frame 1 to do the rotation trick:
    stage.addEventListener(Event.RESIZE, resizeLayout);
    function resizeLayout(e:Event):void
                   setPosition();
    function setPosition():void
            //Phone turned from "Wide" to "Stand"
                   if (stage.stageWidth < stage.stageHeight)
                                  //App is now in "Wide" mode - means between frame 22 to 26
                                  if (currentFrame>20) 
                                                 //go to the same position of App but in "Stand" mode
                                                 gotoAndStop(currentFrame - 20);
                   else
                                  //Phone turned from "Stand" to "Wide"
                                  if (currentFrame<20)
                        //go to the same position of App but in "Wide" mode 
                         gotoAndStop(currentFrame + 20);
    Well, and finally my question:
    1- Is this way I have programed my App to rotate, a proper approach?!
          (in this way I can easily arrange objects on screen and also position them based on math calculations)
    2- If I want to disable auto rotation only when app reaches specific frames, what should I do??
       (for example I want the app Not to auto oriente in Frame 6 and 26., but it rotates in other frames)
    Hope it was not confusing and I cant wait to check out your valuable guidance!
    All the best and thanks a lot for your time.

    Hi there all!!
    Still I have no answer for my question No1, BUT I could find my answer to the 2nd question and here it is for your kind notice:
    Special thanks to Daniel Dura
    http://www.adobe.com/devnet/flash/articles/screen_orientation_apis.html
    I just added this code to my first Frame:
    stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGING, onOrientationChanging);
    function onOrientationChanging(event:StageOrientationEvent ):void
              if (currentFrame == 6 || currentFrame == 26)
                        event.preventDefault();

  • Photo: disable auto orientation?

    Is there a way to tag jpeg files so that ipod touch won't auto orient them?
    The default behavior is when viewing a landscape photo, I turn the ipod touch to landscape orientation and then wait for it to rotate the photo to landscape mode. Although this takes less than a second, it is still annoying.
    I would like all photos to be displayed in the orientation that maximizes display size and let me turn the ipod touch if I want to (or I can just tilt my head).

    i often think this would be a useful feature (not just for photos, personally i never use the landscape/coverflow mode when playing music - mostly because of the lack of control you have over what is playing - it's irritating if it switches by accident)
    tell apple you would like it: http://www.apple.com/feedback/ipodtouch.html

  • Control Levels via Expression

    Is there a way to use a slider to control the various attributes that make up a levels adjustment via expression?  I am able to set them via scripting and have done so.  However, the stopwatch that lets me create an expression is linked to the histogram as a whole, not its individual components, i.e. input black, input white, gamma, etc.  Is this possible or am I barking up the wrong tree here?  The goal is to control multiple levels applied to individual clips in one nice, neat location.  An adjustment layer will not work for me because of layering.  Also, I do not want my background to be effected by the adjustment, just a few of the pieces that make up my foreground objects.

    You have to use Levels Individual controls..

  • Full auto mode=black screen. M mode=bad pic; only works on highest ISO setting

    I usually use the full auto mode on my camera and it worked great.  A few days ago, I used the M mode to take some shots of my son's birthday and everything worked great.  The next day, I went to use the full auto setting to take some pics outside and the picture was black.  The flash won't raise in full auto mode.  When I use M mode, the only way I get  a picture is if I use the highest ISO (6400) and even then, the picture isn't great.  I tried resetting to default thinking that would work, with no luck.  Please help!  I spent a lot of money on this camera and don't understand why it all of a sudden stopped working.

    Exactly. In Manual mode your shots may be solid black or white if your exposure combination is 3 or more stops off one way or the other. Try starting with AV mode (aperture priority mode) or TV (shutter priority mode) before moving on to Manual mode. In those modes you only have to set one of the variables (aperture or shutter speed) and the camera manipulates the remaining variables to give you a correct exposure. Google videos on the exposure triangle and on Av and Tv mode. There are dozens and dozens of good free tutorials by both pros and amateurs to help. Also I recommend buying Bryan Petersen's excellent and easily understood "Understanding Exposure".
    And if we are talking about a camera with a viewfinder you really should be using that instead of the LCD "live view" anyway while handholding. Bracing it against your face with your elbows braced against your body is so much steadier than holding it out at arms length like a phone camera. PLUS the camera focuses much much slower in live view (using the LCD) than it does using the eyepiece because in live view the mirror is flipped up for video and so it is having to focus in a different way than normal.
    Scott
    Canon 6D, Canon T3i, EF 70-200mm L f/2.8 IS mk2; EF 24-105 f/4 L; EF-S 17-55mm f/2.8 IS; EF 85mm f/1.8; Sigma 35mm f/1.4 "Art"; EF 1.4x extender mk. 3; 3x Phottix Mitros+ speedlites
    Why do so many people say "fer-tographer"? Do they take "fertographs"?

  • StageOrientation without device auto-orientation

    There are lots of docs and posts online about being able to use StageOrientation without a device orientation itself having to change (disabling auto-orientation). I have tried autoOrients set to false and the alternative event.preventDefault ... but nothing works. Adobe Flash always changes the device orientation when I get StageOrientation.
    Is there a sample I can download? I have tried every publishing and Actionscript 3 setting/combination and it just isn't working. Auto orientation seems to be the only way to use StageOrientation.
    I am using latest Adobe Flash CC 2014 and can get the app to either auto orientate and show me the StageOrientation value, or lock the orientation and get not StageOrientation value. I tried this on a few ios devices and cannot get this working right. Please help.

    The docs say "In some cases you may want to disable auto-orientation to ... handle resizing the stage and rotating objects yourself. You can accomplish this with ... autoOrients property and set it to false. While you will still receive the ORIENTATION_CHANGE and ORIENTATION_CHANGING events when the actual device orientation changes, the stage will not update to try and match that orientation."
    This does not work in practice however (keeping in mind I have used various combinations of true and false autoOrients and preventDefault - nothing works as described, until setting autoOrients to true, but then the orientation changes, even when I use preventDefault as described in the docs!?):
    stage.scaleMode = StageScaleMode.NO_SCALE;
    stage.align = StageAlign.TOP_LEFT;
    stage.autoOrients = false;
    main.appOrientation.text = 'Loading...';
    // we can control which orientations we want to allow with the following code
    stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGING, onOrientationChanging );
    function onOrientationChanging( event:StageOrientationEvent ):void {
        main.appOrientation.text = StageOrientation;  
        // If the stage is about to move to an orientation we don't support, let's prevent it
        // from changing to that stage orientation.
        if(event.afterOrientation == StageOrientation.ROTATED_LEFT || event.afterOrientation == StageOrientation.ROTATED_RIGHT){
            //main.appOrientation.text = 'Change';
            event.preventDefault();

  • Ship Via Express vs Standand

    Does anyone know if Ship Via Express is USPS, UPS or FedEx? How much faster is Ship Via Express than Ship Via Standard?
    G5 2GHz Dual   Mac OS X (10.4.6)  

    I don't remember exactly where they were shipped from by near Sacramento sounds familiar. The soft cover medium come in envelopes and the first was scrunched into the mail box. It didn't crease the book but could have. The large book, if shipped similarly probably would have been creased knowing how some other large envelops have been added to our mail box in the past.
    The medium's quality was sub par if you compare to the large hard cover. The half tone/dither pattern was obvious to the naked eye at close range. For the intended use, a memory book for each grandkid of a day at SeaWorld with the grandparents, it was perfect. So "quality" is really a matter of intended use and expectations.
    Will be interested to see how the medium books turn out now that we're at V6.

  • Auto orientation does not with Maps app

    iPhone 3GS with iOS 4 does not auto-orient to landscape in Maps display. Auto-orientation still works with other apps. Orientation is not locked.
    Any idea what's happening?

    Your statement is correct. Was there a question?

  • Change Camera Auto Orientation with Script

    Hello,
    I'm trying to figure out how to change the auto-orient setting for a camera in my script. From page 41 of the AE scripting guide it looks like I should be able to affect auto orient with
    " app.project.item(index).layer(index).autoOrient " this allows me to pull up a numeric value for auto orient, however, I'm not really sure how I could go about setting this to a false, I've tried assigning it to false directly but that doesn't seem to work. The guide says to use "AutoOrientType.NO_AUTO_ORIENT " But this if I try something like this I'm just getting undefined returned:
    var myProj = app.project
    var myComp = myProj.activeItem
    var targetLayer = myComp.selectedLayers[0]
    targetLayer.autoOrient.AutoOrientType.NO_AUTO_ORIENT
    Can anyone point me in the right direction, what am I doing wrong here?
    Thanks!

    Try changing your last line to this:
    targetLayer.autoOrient = AutoOrientType.NO_AUTO_ORIENT;
    Dan

  • Enable auto login via command line

    Hi,
    I have an old Mac Mini (G4) running Leopard. My problem is that I cannot log in using Back to my Mac ( Screen Sharing ). I get as far as to the login window, but after login, the machine goes down ( crash completely ). I do not have the same problem with Intel-based Macs. I temporary solved this by activating automatic login. But after an upgrade of Leopard, the problem dissapaired - but after the last upgrade to 10.5.3 the problem is back - as the machine is in an other part of the country, and has no screen or keyboard - I was wondering if anyone can show me how to activate automatic login via the terminal, I have full access via SSH.

    In order for the "defaults write..." method to work, you will need an encrypted version of the user's password stored in /private/etc/kcpassword.
    This is automatically generated when Auto Login is set up via the standard Control Panel. If you don't have physical access, it could be copied from another machine to which you do have physical access and where the auto-logged-in user has the same password. Or it could be copied from any machine that already has the file and it contains the correct password.
    Alternately, there's some discussion of the encryption scheme used for kcpassword and theoretically, you could create the file from scratch. Check out: http://www.brock-family.org/gavin/perl/kcpassword.html

Maybe you are looking for