Local rotation problem

I am programming a spaceship moving around in Java3D.
My problem is that I want the ship to be able to rotate around its z-axis(roll) and along its x-axis(nose up or down), when I am doing this however only one of the axis will follow the ships local coordinates.
The scene looks like this.
BG - TG1 - TG2 - Model
TG2 is the z-axis rotation, and that works fine since it will rotate when T1, the x-axis rotation rotates. T1 however will be fixed to the world and not be affected by TG2s rotation...
How do I make both rotations move along the axis of the local coordinates of the ship, instead of the world axis (BG axis).

That does not matter, one rotation will cone first and that will mess up the other one. It seems like the first rotation is always locked to the world coordinate axis.
This is my behavior code (after combining both transform groups into one):
class FighterRotate extends Behavior
     double angleX;
     double angleZ;
     TransformGroup targetTG;
     Transform3D rotationX;
     Transform3D rotationZ;
     KeyEvent evt;
     WakeupOnAWTEvent awaken;
     FighterRotate(TransformGroup TG)
          angleX = 0;
          angleZ = 0;
          targetTG = TG;
          rotationX = new Transform3D();
          rotationZ = new Transform3D();
          awaken = new WakeupOnAWTEvent(KeyEvent.KEY_PRESSED);
     public void initialize()
          this.wakeupOn(awaken);
     public void processStimulus(Enumeration criteria)
          evt = (KeyEvent)awaken.getAWTEvent()[0];
          if (evt.getKeyCode() == KeyEvent.VK_UP)
               angleX += 0.1;
          if (evt.getKeyCode() == KeyEvent.VK_DOWN)
               angleX -= 0.1;
          if (evt.getKeyCode() == KeyEvent.VK_RIGHT)
               angleZ += 0.1;
          if (evt.getKeyCode() == KeyEvent.VK_LEFT)
               angleZ -= 0.1;
               rotationX.rotX(angleX);
               rotationZ.rotZ(angleZ);
               rotationX.mul(rotationZ);
               targetTG.setTransform(rotationX);
          this.wakeupOn(awaken);
How can I change this to make my model move as it should?

Similar Messages

  • Rotation problem after editing in Photoshop

    I'm using Lightroom 1.3 and Photoshop CS3 with all the current updates. This problem was the same in LR1 and PS CS2.
    I have a mix of orientations in the JPEGs in my library - portrait and landscape. When the photos are imported into LR they appear correct. If I select a bunch of them, open them in PS (using Edit in Photoshop > Edit Originals), run a noise filter, save them, and then go back to LR, the previews for the portrait images are rotated so that all the previews show as landscape.
    The portrait images display correctly (except for the fact that they have been rotated) in the Library module - both grid and loupe view). In the Develop module, the image aspect is displayed portrait but the image is as a distorted landscape - the image is rotated and then distorted to fill the portrait oriented space. In the Print module, that same distorted image is fills the portrait oriented page. To be clear, instead of a portrait image appearing in the correct orientation on a portrait page preview, the image is rotated 90 degrees and then stretched to fill the page.
    There is a badge on the preview indicating that the metadata is out of sync with the file.
    If I rotate the image in LR, the badge goes away and the image appears portrait and undistorted in the Library module's grid and loupe views. The Develop module show the portrait image in the correct rotation, but has been stretched to a landscape aspect. The Print module shows that distorted image rotated to fit the portrait page.
    The only way to correct this is to "Read Metadata from file". This resets all the orientation information so that it displays correctly in LR, but all the tags and IPTC information gets erased.
    This is most of the reason why I was writing all the metadata into to files until now. I would write the metadata before editing in PS, do my PS edits, and then back in LR I'd "Read the Metadata" from the files to set everything correctly in LR. But of course now that I'm working with Leopard I get screwed if I do this because my files will crash the Finder.
    To top it all off, I've run into the "...cannot be saved because the file is in use" problem with some files I opened last night.
    Clearly none of these issues are being addressed in Adobe or Apple's updates. Is there a reasonable workaround that will let me:
    1. set metadata and tags and know that they won't either get lost or cause problems
    2. have image orientation respected and displayed correctly
    3. not crash any of the three critical applications on this computer - Lightroom, Photoshop, and Finder.

    I really appreciate your explaining this Jao.
    I'm going to explain how I got into this situation, in the hopes that it may prove useful to someone (I'm looking at you, Adobe) who wants to understand how the app is being used in the real world.
    So as not to break up the narrative, let me just say that I'd be happy (ecstatic, actually) if I could use Lightroom for my entire workflow, but the noise reduction filter in LR is just nowhere near as good as NoiseNinja. (A problem shared by LR, PS, and Aperture.) If I could run NN from inside LR, that would rock.
    Oh, and I shoot JPEG because I shoot live events where the lighting is usually crap and I need to be ready at any moment for something interesting to happen. Shooting RAW would be nice, but it's too slow and takes up way too much space.
    So here's what I do, (hopefully edited to make the reading non-tedious)
    1. import all photos from source (usually memory cards)
    The photos go onto a drive reserved for photos. I shoot events, so everything is organised by date-event. On import I set filenames (date - event name - time stamp.jpg) and keywords.
    2. cull
    They get marked "1" (irretrievably useless, to be deleted), "2" (keep just in case), "3" (decent shots), "4" (photos that I want to show to other people), or "5" (this is one of my best this year). Delete the "1"s.
    3. select 20-30 "picks"
    I create a folder within the event folder called "Picks" for these photos. Then I duplicate that folder as "Originals"
    In doing it this way I can protect myself if I need/want to change my cataloguing application. I'm on my fourth one at this point (Lightroom) and while I am generally finding that LR is meeting my needs more than anything else I've tried, I've been burned in the past (how many of us have regretted letting Aperture put all our photos into an incomprehensible database/folder hell?)
    The Picks/Originals structure makes sure that the originals never get touched (because it doesn't show up in LR) and I can quickly find the Picks.
    I -was- writing the metadata to the files so the ratings, keywords, and IPTC info was where it should be - attached to the photo. I've stopped doing this for the time being until this whole Finder-craching debacle is corrected.
    So why am I not using LR's built "Edit - Copy"/stacking function, which more or less duplicates my process?
    Well part of it was my own dumbness - Aperture made the edited copy/variation a Photoshop file, which ballooned my collections with staggering speed. I'm not sure if LR used to do the same thing, or I just made the assumption. My mistake.
    The other part of the problem is just the simplicity of having an Originals folder that is effectively ignored. Using LR will mix the "-edited" files in with originals, which is not as efficient or elegant a solution, but I'll give it a whirl.
    Thanks for your suggestion. If giving up my Picks/Original process solves the rotation problem then perhaps it's a fair trade.
    Still, it seems that the right hand is somehow oblivious to what the left hand is doing in the whole PS/LR thing, and that it ought not work that way.

  • IPad Rotation Problem

    After just 1 week bought the iPad.. i'm facing the rotation problem.. the Apple technicians said its hdware problem and send back to Apple Service Centre... Feel very very sad with this situation... wasting my time and probably my money...

    1. Check the little black rotation lock on the edge of iPad.
    2. Try a reset. Hold the Sleep and Home button down for about 10 seconds until you see the Apple logo.
    http://i1224.photobucket.com/albums/ee374/Diavonex/9ecbcd49.jpg

  • Iphone 6 rotating problem

    My ipone6 has rotating problems with for example the calendar app, somtimes it's working but most of time I can't rotate the screen.
    When is this going to be solved, as I many people are complaining about this?

    Try to reset the phone by holding the sleep and home button for about 10sec, until the Apple logo comes back again. You will not lose any data by resetting, but it can cure some glitches.
    If this does not help, setting it up as new device would be the next step:
    How to erase your iOS device and then set it up as a new device or restore it from backups
    Or, if you want to use your computer and iTunes instead:
    Use iTunes to restore your iOS device to factory settings - Apple Support
    If setting it up as new device does not bring back the full functionality of your brightness settings, get the phone checked by visiting an Authorized Apple Service Provider, Apple Store or contact Apple Support to have it serviced:
    iPhone - Contact Support - Apple Support

  • New log rotation problem

    I have resolved some log rotation problem...I have set del log rtation by size...and now the first time the log rotate,but then the output continue to go on the lod with the extension .log001 and not on the configured file.
    why?

    no,it the server rotates the log only the first time but then it continues to write on the .log001.On the original file it continues to write some server exception.
    the server launch line in the scritp is the follow
    nohup "$JAVA_HOME/bin/java" ${JAVA_VM} ${JAVA_OPTIONS_NODE} ${JAVA_OPTIONS} \
    Dweblogic.Name=${SERVER_NAME} \
    Dweblogic.ProductionModeEnabled=${PRODUCTION_MODE} \
    Djava.security.policy="${WL_HOME}/server/lib/weblogic.policy" \
    Dweblogic.Stdout=/u02/bea/weblogic81/mydomain/mydomain_LOG/myserver_Admin.log \
    Dweblogic.Stderr=/u02/bea/weblogic81/mydomain/mydomain_LOG/myserver_Admin.log \
    weblogic.Server > /dev/null &
    and the config.xml part for the server configuration is the follow
    <Server COMEnabled="true" CompleteMessageTimeout="0"
    ConsoleInputEnabled="false" EnabledForDomainLog="true"
    ExpectedToRun="false" JDBCLogFileName="./mydomain_LOG/jdbc.log"
    JDBCLoggingEnabled="true" JavaCompiler="javac"
    ListenAddress="10.2.1.16" ListenPort="10001"
    MaxMessageSize="100000000" Name="myserver_Admin"
    ServerVersion="8.1.3.0" SocketReaderTimeoutMaxMillis="10"
    StagingMode="nostage" StdoutDebugEnabled="true"
    StdoutEnabled="true" StdoutSeverityLevel="16" TransactionLogFilePrefix="../myserver_LOG/myserverAdminTransaction.log">
    <SSL Enabled="false" IdentityAndTrustLocations="KeyStores"
    ListenPort="10002" Name="myserver_Admin"/>
    <Log FileCount="4" FileMinSize="30"
    FileName="/u02/bea/weblogic81/mydomain/mydomain_LOG/myserver_Admin.log"
    FileTimeSpan="1" Name="myserver_Admin"
    NumberOfFilesLimited="true" RotationType="bySize"/>
    <WebServer LogFileCount="2" LogFileLimitEnabled="true"
    LogFileName="./mydomain_LOG/access.log"
    LogRotationPeriodMins="360" LogRotationType="size"
    MaxLogFileSizeKBytes="20000" Name="myserver_Admin"/>

  • Rotation Problem on FCP

    Friends,
    When I rotate a video on FCP (does not matter the degrees, 20, 45, 90...), using the motion tab, my rendered images gets sort kind of distortion... When I preview it on FCP, it rotates ok, but when I export using the Compressor, when the video rotates, it squeezes, it does not look right...
    Please, could someone help me?
    Thanks

    Yes - the button is in rotation lock mode (not mute).
    Neither switch setting (up or down) work. The state of the button is accurately reflected on the screen when changed, but the problem of not rotating problem when unlocked persists.
    Given that this started just after updating to iOS 7.0.6 I'm inclined to think there is a software issue.

  • Image Orientation/Rotation Problem in Lightroom 3.2 Final

    This is a continuation of my previous post regarding this same problem in 3.2RC. It's still happening in the Final version of Lightroom 3.2.
    THE PROBLEM
    Image orientation is not working properly in Lightroom 3.2. This affects newly imported images and images that were already in my Lightroom database -  and which have been in the database since Version 1.
    Here's a screen capture showing the strange displays I'm seeing in  Lightroom's grid mode:
    Notice the odd angle of the image. When I use the Rotate Photo Left tool, the display looks like this sometimes. After a second or so, it will snap to either a vertical or horizontal orientation by itself but rarely gives me the 90-degree rotation this tool should give. The image may flip 90-degrees or 180-degrees, there's no way to tell.
    When I view the image in Loupe view or on my second monitor, the orientation shown in Grid view does not match that displayed in Loupe Vew. For this particular image, Grid view currently shows it as correctly orientated as a horizontal while Loupe view shows it rotated 90-degrees to the right. Shouldn't they match?
    BACKGROUND
    I never had a problem with image orientation in any preveious version of Lightroom prior to Lightroom 3.2RC and 3.2 Final. So, it seems to be a bug in 3.2. I'm still using the same computer and video card I used with previous versions. My operating system is Windows 7 Home Premium. Both Windows and Lightroom are 64-bit.
    HELP!
    Is anyone else having this problem? How can I solve it?
    Alan
    PhtooCitizen.com

    The size of the catalogue is almost certainly not at play here.
    FWIW, I recall seeing something like this once a long time ago on a Mac, possibly with Lr 3 beta, or Lr 2.x.  It went away with a restart. It almost looks like a threading issue, where a thread is suspended or preempted and then is lost or disconnected from the main UI thread.
    I recall you can just rotate the image again and it will right itself.
    Adobe fist-line support seem to want to use the number of images in the catalogue as some sort of catch-all.  The problem with this is that most of us can demonstrate that there is little correspondence with the number of image IDs in the database and many reported UI artefacts.
    I'd keep raising this with them, and suggesting that the size of the catalogue is probably not at play here. As a tactic, you can ask what the maximum size of a catalogue should be, and if it is raw images or the number of changes to the images and virtual copies that is the problem, and if this can be verified by second- or third-line support.

  • Firefox won't load .mov files online but plays them locally: QT problem?

    My website has several pages with embedded .mov files, which used to play perfectly well, but now only give a question mark after the progress bar fills up.
    For example, one of these pages is http://www.paulozelinsky.com/shivers-animation2a.html
    Firefox can open this and similar pages that are stored in my computer (on a mirror of the site) and view the animations normally. But online it doesn't work. Typing the path to the online animation file into Firefox's URL field also produces an empty QuickTime window with a question mark, so it's not a matter of the page code.
    Is it possible that QuickTime's plugin isn't compatible with Firefox, at least for .mov files like mine? (Created with After Effects 7, using Sorensen 3 codec). Does Firefox use plugins in the same way for playing a file on a web server as playing it in a local folder? Or could there be something going on with my web host?
    I would at least like to know if this failure to load the animation is the same for other Mac Firefox users. I have heard that the animation does load, though slowly, for at least one PC Firefox user.
    When I first noticed the change, the problem was occurring in Safari as well as Firefox, but now it is only in Firefox.
    I have Firefox 3.6.8, and in HD/Library/Internet Plug-Ins I have QuickTime Plugin.plugin v. 7.6.6. I also see in there something called nsIQTScriptablePlugin.xpt.

    Bump, bump. Please can anybody help?

  • Character rotation problem in tiled map

    Hi I am trying to rotate the character in a tiled map. Its is successful but theres problem with moving diagonally. When i pressed for example up and right keypressed, when its moving it will rotate as i wanted but when i released the buttons, it either rotate to the up or right. I want the image to rotate diagonally and stay as it is when i released the buttons.
    Here are my source code...I noe its very long but really need someone help...There are 3 java files. (Sorry for dis long and ridiculous codes...)
    1) Game.java
    import javax.swing.*;
    import java.awt.*;
    import java.awt.image.BufferStrategy;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    public class Game extends Canvas implements KeyListener
         private BufferStrategy strategy;
         private GameMap map=new GameMap();
         private Player player;
         private boolean left,right,up,down;
         Image ship = Toolkit.getDefaultToolkit().getImage("res/up1.PNG");
         public Game()
              Frame frame = new Frame("Pirate Game");
              frame.setLayout(null);
              setBounds(0,30,480,510);
              frame.add(this);
              frame.setSize(480,510);
              frame.setResizable(false);
              // exit the game
              frame.addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        System.exit(0);
              frame.addKeyListener(this);
              addKeyListener(this);
              frame.setVisible(true);
              createBufferStrategy(2);
              strategy = getBufferStrategy();
              player = new Player(ship, map, 1.5f, 1.5f);
              // start the game loop
              gameLoop();
    public void gameLoop()
              boolean gameRunning = true;
              long last = System.nanoTime();     
              // keep looking while the game is running
              while (gameRunning)
                   Graphics2D g = (Graphics2D) strategy.getDrawGraphics();
                   // clear the screen
                   g.setColor(Color.black);
                   g.fillRect(0,0,480,480);
                   // render our game objects
                   g.translate(0,0); //placing the map to desired location on the frame
                  map.paint(g);
                   player.paint(g);
                   // flip the buffer so we can see the rendering
                   g.dispose();
                   strategy.show();
                   // pause a bit so that we don't choke the system
                   try { Thread.sleep(4); } catch (Exception e) {};
                   long delta = (System.nanoTime() - last) / 1000000;
                   last = System.nanoTime();
                   for (int i=0;i<delta / 5;i++)
                        logic(5);
                   if ((delta % 5) != 0)
                        logic(delta % 5);
         public void logic(long delta) {
              // check the keyboard and record which way the player
              // is trying to move this loop
              float dx = 0;
              float dy = 0;
              if (left)
                   dx -= 1;
              if (right)
                   dx += 1;
              if (up)
                   dy -= 1;
              if (down)
                   dy += 1;
              // if the player needs to move attempt to move the entity
              // based on the keys multiplied by the amount of time thats
              // passed
              if ((dx != 0) | (dy != 0))
                   player.move(dx * delta * 0.0015f,dy * delta * 0.0015f);
         public void keyTyped(KeyEvent e) {}
         public void keyPressed(KeyEvent e)
              if (e.getKeyCode() == KeyEvent.VK_LEFT)
                   left = true;
              if (e.getKeyCode() == KeyEvent.VK_RIGHT)
                   right = true;
              if (e.getKeyCode() == KeyEvent.VK_DOWN)
                   down = true;
              if (e.getKeyCode() == KeyEvent.VK_UP)
                   up = true;
         public void keyReleased(KeyEvent e)
              if (e.getKeyCode() == KeyEvent.VK_LEFT)
                   left = false;
              if (e.getKeyCode() == KeyEvent.VK_RIGHT)
                   right = false;
              if (e.getKeyCode() == KeyEvent.VK_DOWN)
                   down = false;
              if (e.getKeyCode() == KeyEvent.VK_UP)
                   up = false;
         public static void main(String args[])
          new Game();
    2) GameMap.java
    import javax.swing.*;
    import java.awt.*;
    import java.util.*;
    public class GameMap
         int width = 15;
        int height =15;
        static final int TILE_SIZE = 32;
             int[][]  A  =  {{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
                                 {1,2,2,2,2,2,2,2,2,2,2,2,2,2,1},
                                 {1,2,2,2,2,2,2,2,2,2,2,2,2,2,1},
                                 {1,2,2,2,2,2,2,2,2,2,2,2,2,2,1},
                                 {1,2,2,2,2,2,2,2,2,2,2,2,2,2,1},
                                 {1,2,2,2,2,2,2,2,2,2,2,2,2,2,1},
                                 {1,2,2,2,2,2,2,2,2,2,2,2,2,2,1},
                                 {1,2,2,2,2,2,2,2,2,2,2,2,2,2,1},
                                 {1,2,2,2,2,2,2,2,2,2,3,2,2,2,1},
                                 {1,2,2,2,2,2,2,2,2,2,2,2,2,2,1},
                                 {1,2,2,2,2,2,2,2,2,2,2,2,2,2,1},
                                 {1,2,2,2,2,2,2,2,2,2,2,2,2,2,1},
                                 {1,2,2,2,2,2,2,2,2,2,2,2,2,2,1},
                                 {1,2,2,2,2,2,2,2,2,2,2,2,2,2,1},
                                 {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
        Image sea = Toolkit.getDefaultToolkit().getImage("res/sea.PNG");
        Image rock = Toolkit.getDefaultToolkit().getImage("res/rock.PNG");
         public void paint(Graphics g)
            for(int across = 0; across < width ; across++)
                for(int vert = 0; vert < height ; vert++)
                    if (A[across][vert] == 1)
                    g.drawImage(rock,across*TILE_SIZE,vert*TILE_SIZE,null);
                         else
                         g.drawImage(sea,across*TILE_SIZE,vert*TILE_SIZE,null);
        public boolean blocked(float x, float y)
              return A[(int) x][(int) y] == 1;
    3) Player.java
    import java.awt.Graphics2D;
    import java.awt.Image;
    public class Player {
         private float x;
         private float y;
         private Image image;
         private GameMap map;
         private float ang;
         private float size=0.3f;
         public Player(Image image, GameMap map, float x, float y)
              this.image = image;
              this.map = map;
              this.x = x;
              this.y = y;
         public boolean move(float dx, float dy)
              // new position
              float nx = x + dx;
              float ny = y + dy;
              //check collision
              if (validLocation(nx, ny)) {
                   x = nx;
                   y = ny;
                   // and calculate the angle we're facing based on our last move
                   ang = (float) (Math.atan2(dy, dx) + (Math.PI / 2));
                   return true;
              // if it wasn't a valid move don't do anything apart from tell the caller
              return false;
         public boolean validLocation(float nx, float ny)
              if (map.blocked(nx - size, ny - size))
                   return false;
              if (map.blocked(nx + size, ny - size))
                   return false;
              if (map.blocked(nx - size, ny + size))
                   return false;
              if (map.blocked(nx + size, ny + size))
                   return false;
              return true;
         public void paint(Graphics2D g) {
              int xp = (int) (map.TILE_SIZE * x);
              int yp = (int) (map.TILE_SIZE * y);
              // rotate the sprite based on the current angle and then
              // draw it
              g.rotate(ang, xp, yp);
              g.drawImage(image, (int) (xp - 16), (int) (yp - 16), null);
              g.rotate(-ang, xp, yp);
    }

    rotate() should always be accompanied with appropriate translate().
    See:
    http://java.sun.com/docs/books/tutorial/2d/TOC.html
    http://www.adtmag.com/java/articleold.aspx?id=1241
    http://www.apl.jhu.edu/~hall/java/Java2D-Tutorial.html
    And, never mix AWT components with Swing ones.
    Use JPanel instead of Canvas.
    Use also standard drawing/painting technique shown above URSs.

  • Save Grid Alv as Local File Problem

    Hi,
    The Alv output via REUSE_ALV_GRID_DISPLAY, when i export ALV to local file as Excel some cells are converted the value.
    Ex.
    06MAY51   " display as char on ALV, there is no problem, this value of a plaque of a vehicle
    06.May.51   " display as date on Excel, converts char to date, and the value is displaying as 06.05.1951 (date)
    i dont know this convertion happens.
    can somebody help me please?
    best regards
    Edited by: Rob Burbank on Jun 7, 2011 3:56 PM

    Hi,
    i opened the excel file in notepad and i saw the values are not converted. 06MAY51
    and i created a blank excel file then i entered this value into a blank cell then i saw the values are converted by the excel.
    so i think there is no problem in SAP.
    the another way is to display ALV as Excel in SAP using Excel button on ALV then save the Excel, but if the ALV have too much values, it is not working. it is waiting too much. it is trying to compile the ALV to Excel format.
    Thanks

  • Local variable problem

    I am making an application that takes an apartment number and number of occupants in that apartment and then displays a number of statistics. So far I haven't had much problem
    except on a what is probably a very simple problem.
    I have two buttons, and when "store" is clicked the info in the textboxes is input to an array.
    My problem is with the next button, "quit", this is where all the info is supposed to be displayed.
    All my variables that I need from "store" are local and are recognized in " the if statement in quit. Ive tried declaring them outside of the if statement, but it hasn't been working.
    {code}
    public void actionPerformed(ActionEvent event)
                   Object source = event.getSource();
                   Apartment input;
                   if (source == store)
                        Integer aptNo = Integer.parseInt(input1.getText());
                        Integer occup = Integer.parseInt(input2.getText());
                        input = new Apartment(aptNo, occup);
                        if(aptNo > BUILDING_SIZE)
                             JOptionPane.showMessageDialog(null, "That apartment number doesn't exist.");
                        else if(occup > MAX_OCCUPANTS)
                             JOptionPane.showMessageDialog(null, "Too many occupants, only 20 are permitted per apartment.");
                        else
                             occupants[aptNo] = occup;
                             input1.setText("");
                             input2.setText("");
                             JOptionPane.showMessageDialog(null, input.getNumber(occupants));
                   if (source == quit)
                   // I need the variables aptNo and occup in here to put into my methods for output, but I don't know how to get them.     
    {code}

    EmmCeeVee wrote:
    Thank you for all of the responses, it really helps me out.
    Obviously my knowledge of local variables is hurting as I switched it around as your said and declared the aptNo and occup outside of the if's.
    All I need is for the quit button to look at the array ( which has just been modified by the sotre button) and output a bunch of results.
    Heres where im at:Your problem is of scope of the variables.
    Here whatever variable you defined in actionPerformed they are local for that method (they are out of scope when the method is finished/called again), Upon this, the actionPerformed is called twice one for store and another time for quit. So you cant expect the value stored at store should be there still when you all quit
    If you want those values available on both the actions then make them a class level variables.
    Below is a sample program, might help you.
    class Employee
         String empName = null;
         int empNo;
         Employee(String eName,int eNmbr)
              this.empName = eName;
              this.empNo = eNmbr;
    class CheckVariableScope
            Employee empOb; // Here
         int eNo;
         String eName = null;
         public void checkScope(String action)
                    //Instead of defining Employee reference variable, eNo and eName  in checkScope method, define it @ class level.
                    // in your case they are Apartment input, Integer aptNo and Integer occup
                     // like above i did.
                     // If i comment the class level variable and uncomment method variable, this program also give the same error.
              //Employee empOb;
              //int eNo;             
              //String eName = null;
              if (action.equals("Store") )
                        eNo = 10;
                        eName = "Bob";
                        empOb = new Employee(eName, eNo);
                        System.out.println("The eName is : "+empOb.empName+" , empNo is : "+empOb.empNo);
                   if (action.equals("quit"))
                        System.out.println(" eNO from Object is : "+empOb.empNo);
                        System.out.println(eNo); //Error: may not have been intitialized
         public static void main (String st[])
              CheckVariableScope ob = new CheckVariableScope();
              ob.checkScope("Store");
              ob.checkScope("quit");
    }

  • After Effects Puppet Tool "Warping Upon Rotation"problem

    Hi Everyone,
    I am having a big issue with my newly puppeted after-effects character. I have rigged up a character I made originally in illustrator. I placed puppet pins, expressed to null objects I use as controllers, then parented to each other. I have done this many times before, with no problem. However, this time, when I rotated the "Parent" Null, the child nulls follow as usual, but in this case, the object is warped through the rotation (attached pictures below). I have been using the "Puppettools 3" Plug-in, and when the bug showed up using that, I tried using this expression (upon the pins themselves):
    A=thisComp.layer("NULL_OBJECT");
    fromWorld(A.toWorld(A.anchorPoint));
    which accomplishes the same thing, just through a longer, manual process. In both cases, the object warps. Before expressing to nulls, the rotation works fine. Anyone know why it would be behaving like this? Perhaps there is something I overlooked in the process? Not sure. Any help appreciated. Thanks
    First image: starting point.
    Second image: rotation only on the "Parent" null and pin. no other pins moved, it simply warps to that form without my action.

    Hi Rick,
    Thank you for this detailed and exemplified response, everything you are saying makes sense, and the examples seem to be exactly what I am dealing with. I tested out this troubleshooting option, but unfortunately, my mesh is still not working. I tried different values of triangles - 200, 350, 370, 600, 900, and even 1500 (the max), and it still warps. My best number was 1024, but that also seems ridiculously high. Could it be because my pin placements are not linear enough? Or there are too many in such a small area? My triangles don't seem to distribute as well as yours. Here are pictures of my mesh:

  • Image Rotation Problem in LR 3.2RC

    Anyone else having an issue with image rotation in Lightroom 3.2C?
    Here's what happens:
    I import images from my card. There are a combination of images taken horizontally and vertically. The vertical images come in sideways (horizontally). This is no big deal: maybe the cameras I was using in this case (Olympus E-PL1 and Panasonic GF1) don't properly mark the orientation.
    So, in Grid view,  I select one of the improperly orientated images and click the "Rotate Photo Left" arrow in the toolbar. Here's where it gets weird. Instead of rotating the image 90-degrees counter clockwise, the thumbnail rotates about 45-degrees, so now it's crooked in Grid view. However, on my second monitor, the image now looks properly orientated.
    I've tried rotating using the menu (Photo menu / Rotate Left) and got the same result. If I repeatedly rotate, it ends up in all sorts of odd positions in grid mode.
    What's up with this? Is it just me?
    Alan
    PhotoCitizen.com

    Restarted Lightroom and all looks good now. I'll be interested to see if the problem returns next time I import images.
    UPDATE: I spoke too soon. Closed LR3 and opened it again. No, the cockeyed thumbnails are not saved at their odd angles. But they still don't match the image shown on my 2nd monitor (or on my main monitor either if I go to Loupe View). The Grid view image might show the vertical image lying on its side (horizontal), even though the 2nd monitor shows it in the correct orientation.
    This happens with horizontal images too if I try to rotate them - something I tried just now but wouldn't normally need to do.
    Trying to rotate the thumbnail again results in the cockeyed thumbnail. If I then CLICK on that thumbnail, it straightens out, but never in the correct orientation. Here's a screen grab:
    Something seriously wrong here. Something that NEVER happend in Lightroom 3 until I installed version 3.2RC. So, I doubt that it's a video card problem - looks like a bug to me.
    Alan
    PhotoCitizen.com

  • Camera Rotation Problem

    Hello
    I have a problem with my camera rotation. I would like to have a button which allows me to rotate a camera in my scene using only x and y axe and with z axe blocked. My javascript is :
    var c = getAnnots3D(0)[0].context3D;
    var camera = c.scene.cameras.getByIndex(0);
    var camdir = camera.position.subtract(camera.targetPosition);
    camera.position.set(-Math.sin(3.14/6)*camdir.y+Math.cos(3.14/6)*camdir.x,Math.cos(3.14/6) *camdir.y+Math.sin(3.14/6)*camdir.x,camdir.z);
    Script works good for x and y axe , but unfortunatelly z axe moves too(kind of a wave, starts low goes up and ends down after Pi/2) . Even if I block it using a constant instead of camdir.z, it moves but javascripy debugger shows z value blocked.
    Any idea what I'm doing wrong ?
    Help appreciated
    Bartek

    Your math really doesn't make any sense to me.
    All those math.cos(..) calls are constant because you are only passing constants. i.e. Math.cos(3.14/6) will always be 0.866158094. So you are doing this:
    position.set(-.9y + .5x, .9x + .5y, z);
    I'm not really sure what this "button" is supposed to do. if you want it to prevent the camera from tilting up and down, you have to repeatedly prevent the camera from tilting using a TimerEventHandler.
    Also, you are taking the camera direction and using it to set it's position, this will keep moving the camera near the origin and will probably be unpredictable.
    So really, I'm not sure what you are trying to do. Let the camera rotate freely in only 2 of it's own axis? only 2 of the world axis? or orbit an object only on 2 axis? only let it move left and right, but prevent it from tilting up or down? ...
    I can help, but you need to be more specific.

  • Rotation problem...

    Hi, I have a problem with rotation, landscape mode. When I turn device more, it turns to portrait mode (upside down). Please fix this problem for me and for users who read when they lie
    thanks

    Thank you for the photos. I think I finally understand the problem.
    So you do not want Adobe Reader to support the Upside Down device orientation.
    Actually, there are four device orientation options that are available for iPhone and iPad respectively in Xcode.
    It is not wrong to support the Upside Down device orientation.  But most iPhone apps do not.  In contrast, most iPad apps do.
    Since we do not have any particular reason to support the Upside Down device orientation for iPhone, we can disable it so that Adobe Reader for iOS will behave like most other iPhone apps.
    The change will be included in a future release of Adobe Reader for iOS.   (Sorry, I am not able to speculate on the next release date.)
    Thank you for the feedback!

Maybe you are looking for

  • Creation of BOM for given scenario

    Hi All I have a requirement of creating BOM under the given scenario: I am currently into some food industy implementation wherein a certain raw food product is bought from farmers, It is then segregated as per the grade through a grading machine, th

  • How do I install PSE 9 without a CD Drive?

    I have a new computer that doesn't have a CD Drive.  How do I install my copy of PSE 9 without getting an external CD Drive?  Where can I download a copy from?

  • IDOC segment Data updation problem

    I have done the Idoc extention for ORDERS05.I have written a code to insert data for my z segments in IDOC_INPUT_ORDERS.But when I run the program its not updating data to z segements as well as other segments What may be the problem.. READ TABLE ded

  • How to start developing forms with weblogic server???

    I am a beginner. I saw someone working on developer 6i and I love the ease so I come to oracle. BUT now I find this weblogic server for desktop applications (forms) too. 1. Please recommend me a book for developing desktop applications in weblogic se

  • Webdynpro ABAP date navigator dynamic start up date

    Hi,    When i am using a date_navigator  for 3 months display the startup date for that i have given has 01.07.2009. So the calendar starts with July to Sep. But i want to get the first month to be the current month.it is throwing exception when i tr