Rotating object around global axises.

Hi there. I'm writing a simple Java3D application, intended for viewing a object loaded from OBJ file, allowing user to scale and rotating this object, by using keyboard, around all axises.
My problem is, that every rotation is occurring around local axises, apparently relative to object, and my intention is, to rotate object relatively to world's coordinations or just camera's.
My Behaviour class code goes here:
(some variables names are in my native language)
public static class ObjectManipulation extends Behavior{
    private TransformGroup targetTG;
    private Transform3D trans = new Transform3D();
    private Transform3D temp_trans = new Transform3D();
    private double skala = 0.4f;
    ObjectManipulation(TransformGroup targetTG) {
        this.targetTG = targetTG;
    public void initialize() {
        this.wakeupOn(new WakeupOnAWTEvent(KeyEvent.KEY_PRESSED));
    public void processStimulus(Enumeration criteria) {
    WakeupCriterion wakeup;
    AWTEvent[] event;
        while( criteria.hasMoreElements() ) {
          wakeup = (WakeupCriterion) criteria.nextElement();
          if(wakeup instanceof WakeupOnAWTEvent) {
                event = ((WakeupOnAWTEvent)wakeup).getAWTEvent();
                    for( int i = 0; i < event.length; i++ ) {
                        if( event.getID() == KeyEvent.KEY_PRESSED )
checkEvent((KeyEvent)event[i]);
this.wakeupOn(new WakeupOnAWTEvent(KeyEvent.KEY_PRESSED));
private void checkEvent(KeyEvent ke) {
int klawisz = ke.getKeyCode();
if(klawisz == KeyEvent.VK_S) {
temp_trans.rotY(Math.PI/10.0f);
trans.mul(temp_trans);
targetTG.setTransform(trans);
} else if (klawisz == KeyEvent.VK_A) {
temp_trans.rotY(Math.PI/-10.0f);
trans.mul(temp_trans);
targetTG.setTransform(trans);
} else if (klawisz == KeyEvent.VK_W) {
temp_trans.rotX(Math.PI/10.0f);
trans.mul(temp_trans);
targetTG.setTransform(trans);
} else if (klawisz == KeyEvent.VK_Z) {
temp_trans.rotX(Math.PI/-10.0f);
trans.mul(temp_trans);
targetTG.setTransform(trans);
} else if (klawisz == KeyEvent.VK_X) {
temp_trans.rotZ(Math.PI/10.0f);
trans.mul(temp_trans);
targetTG.setTransform(trans);
} else if (klawisz == KeyEvent.VK_C) {
temp_trans.rotZ(Math.PI/-10.0f);
trans.mul(temp_trans);
targetTG.setTransform(trans);
} else if (klawisz == KeyEvent.VK_M) {
if(skala > 0.1f) {
skala -= 0.1f;
} else {
skala = 0.0f;
trans.setScale(skala);
targetTG.setTransform(trans);
} else if (klawisz == KeyEvent.VK_N) {
if(skala <= 3.0f) {
skala += 0.1f;
} else {
skala = 3.0f;
trans.setScale(skala);
targetTG.setTransform(trans);

OK, using the tornado example. i want the point where the 'tornado' meets the 'ground' to spin so that the 'tornado', well, looks like a tornado, spinning around a specific, i.e. x,y,z pixel. instead i have a tornado that seems to be pulling doughnuts in the farm carving out a huge cirlce (like the aliens do) rather than what a stationery tornado would carve out (if there was such a thing).
if it helps, think about the bounding box that surrounds an object or layer. the entire bounding box spins around the anchor point, or at least that's what it seems it is doing. it draws a huge circle that it ROTATES around rather then one point that is SPINS around. think about rotating a camera around it's Y axis, the whole box rotates, moving everything rather than spinning without moving. thanks.
hope this helps.

Similar Messages

  • How to always rotate objects around the same point, even using the right-click menu?

    I need some of my objects to always rotate around the same point. How can I select a point which will stay that way?
    Using the rotate tool resets after deselecting.
    Also, I'd like to rotate objects around a certain point even when using the right click > Transform > Rotate.
    Is it possible?

    Right, so this is where Illustrator falls short with respect you your need, but only in the sense that the reference point can't be made to stick. You can, however, use Smart Guides to make it so the point is easy to set at exactly the same location, (especially since your object has an anchor point there), manually before each rotation.

  • Rotate a Object Around Center Axis

    Hey peoples, new to flash here.  I'm using CS3 with ActionScript 3.0.  What I want is simple, and I've done some searching but nothing that can get me the right results.  I'm going to post a link that does exactly what I want:
    http://www.newgrounds.com/dump/item/d25a3dd46f2ff49f2ec892c425cbbd1e
    This rotates the circular object around a center point in a way that you can distort the object yet is still remains turning in a circular motion.  A simple motion tween rotating the image will only work if the object is perfectly round, so distorting the object to make it more straight or curved won't work with a simple tween.  I want to do exactly what is happening here (with my own object), is there some AS3 behind the scenes here making this turn on a center point??  Thanks for the help

    Yes, but I still don't know what you mean by the parent child relationship.  Lets say I use a simple rotate line like:
    objectname.rotation = 360;
    That should spin it, but how do I spin it correctly if the object is skewed like in the bottom right picture of my example?

  • Javascript function to rotate an object around its axis

    Hello,
    I wonder if it is possible to rotate an object around its axis (eg 45 ° rotation)?
    I want to make this rotation with a button and a Javascript code!
    Is it possible? if so, have a track for me to start?
    thank you

    Possible, yes - but you will need some basic knowledge of how 3D matrix transformations work if you want to do anything complex.
    The code to rotate a node in a 3D scene by 45 degrees on the X axis is
    myNode.transform.rotateAboutXInPlace(Math.PI/4)

  • Rotation around global coordinates?

    hey, i wanna to make an animation of camera. the situation looks in this way:
    i have a box in center of global coordinates and i want to make a rotation of camera around y axis (y of global coord.). when i use setOrientation(...) it makes a rotation around local coordinates of camera. how change it if i want to rotate it with global coordinates? im completly new in 3dmobile, i tried to found any solutions with api documenation but i couldnt :(. i have to make it quickly so i dont have time to read all spec.
    please help me!
    thanks in advance

    ok nevermind :]

  • Distributing objects around a circle

    Hi everyone,
    I'm new here, so I'm sorry if I post it to a wrong section.
    I'm a begginer with Illustrator and I've got a problem with distributing objects around a circle in Illustrator cs6.
    What I'm trying to do is to have these acrhed lines (as per the top three curves you can see below) go around a circle, surrounding it (don't know if i explain myself good...). I was using both blend tool and rotate tool and it doesnt work for me the way I want it. All the time its sort of upside down at the bottom of the cirle and totaly twisted on the left and right... I guess im doing smth wrong, but I just can't find anything helpfull on web..
    Would appreciate it a lot if you could helo me!
    Thanks in advance and sorry for my English, its not my 1st language.

    Cat Nat,
    A completely different way, which may be (un)usable for your purpose is to create the circle with a Stroke Weight corresponding to the width of the arched lines and then in the Stroke palette/panel  apply Dashed line with Round Caps and suitable Dash and Gap values (you may try different values until you get it right).
    You may use the free Adjust Dashes script available here,
    http://park12.wakwak.com/~shp/lc/et/en_aics_script.html
    to get an even distribution/final adjustment.

  • Distributing objects around circle

    I am working on Mac OS 10.4.11 and Adobe CS3 ME.
    I know it's possible to evenly distribute objects in a line. But I would like to evenly distribute objects in a circle shape. Can that be done in Indesign or Illustrator?

    Yes, it can be done in either InDesign or Illustrator.
    I'm going to give you the steps in InDesign, but Illustrator is almost identical.
    First draw the shape that you want to distribute. Position it where you would want the top or 12 o'clock item.
    Now, switch to the Rotate tool. As you do, a rotation center point appears inside the bounding box of the original object.
    This center point needs to be moved to the center of the circle that you want to rotate the object around. (Or where the hands of the clock would originate from.)
    Hold the Option or Alt key and click where the roatation center point needs to be.
    A dialog box appears.
    Enter the angle of roation. This is usually an amount that is created by dividing 360. For instance, if you want 10 objects around the circle, you would enter the rotation amount of 36 degrees.
    If you wanted 12 objects, you would enter the rotation amount of 30 degrees. You figure out what you want.
    Use the Preview amount to see what it would look like. When you like what you have, click the Copy button (not the OK button).
    You will now have one new object in position. At this point you have "primed the pump" so to speak. InDesign now knows to make a copy at a certain rotation.
    Go to Object > Transform Again > Transform Again. The keyboard shortcut is Cmd-Opt-3 or Control-Alt-3.
    Each time you invoke the command, a new copy appears in position.
    This is the classic way to distribute objects in a circle.
    There are other ways to do it that would put the object around an actual circular object.
    But you might as well learn this one first.

  • Help with understanding script for rotating objects

    Hi all
    would some help me with this, I am trying to understand what part of AS3 script says loop through(create a continues 360 loop of objects) the images from an XML file, does this make any sense.
    in my script I have this
    for(var i:int = 0; i < images.length(); i++)
    is this the part that says loop the images/objects
    this is a little more to the script including the above to maybe understand better?
    private function onXMLComplete(event:Event):void
    // Create an XML Object from loaded data
    var data:XML = new XML(xmlLoader.data);
    // Now we can parse it
    var images:XMLList = data.image;
    for(var i:int = 0; i < images.length(); i++)  <<<<<<<<FROM ABOVE ///        {
    // Get info from XML node
    var imageName:String = images[i].@name;
    var imagePath:String = images[i].@path;
    var titles:String = images[i].@title;
    var texts:String = images[i].@text;
    any help would be great

    hi rob
    ok I found this menu which rotates item around on a 360 wheel trying to see if I can use the same script on my menu,
    link to example: http://art.clubworldgroup.com/menu/R...g_menu_AS3.zip
    I have highlighted in blue what creates the loop of items
    in my menu I do  ot have anything like
    var angleDifference:Number = Math.PI * (360 / NUMBER_OF_ITEMS) / 180;
    which sest up the 360 circle of the item
    //Save the center coordinates of the stage
    var centerX:Number=stage.stageWidth/2;
    var centerY:Number=stage.stageHeight/2;
    //The number of items we will have (feel free to change!)
    var NUMBER_OF_ITEMS:uint=15;
    //Radius of the menu circle (horizontal and vertical)
    var radiusX:Number=200;
    var radiusY:Number=200;
    //Angle difference between the items (in radians)
    var angleDifference:Number = Math.PI * (360 / NUMBER_OF_ITEMS) / 180;
    //How fast a single circle moves (we calculate the speed
    //according to the mouse position later on...)
    var angleSpeed:Number=0;
    //Scaling speed of a single circle
    var scaleSpeed:Number=0.0002;
    //This vector holds all the items
    //(this could also be an array...)
    var itemVector:Vector.<Item>=new Vector.<Item>;
    //This loop creates the items and positions them
    //on the stage
    for (var i:uint = 0; i < NUMBER_OF_ITEMS; i++) {
        //Create a new menu item
        var item:Item = new Item();
        //Get the angle for the item (we space the items evenly)
       var startingAngle:Number=angleDifference*i;
        //Set the x and y coordinates
        item.x=centerX+radiusX*Math.cos(startingAngle);
        item.y=centerY+radiusY*Math.sin(startingAngle);
        //Save the starting angle of the item.
        //(We have declared the Item class to be dymamic. Therefore,
        //we can create new properties dynamically.)
        item.angle=startingAngle;
        //Add an item number to the item's text field
        item.itemText.text=i.toString();
        //Allow no mouse children
        item.mouseChildren=false;
        //Add the item to the vector
        itemVector.push(item);
        //Add the item to the stage
        addChild(item);
    //We use ENTER_FRAME to animate the items
    addEventListener(Event.ENTER_FRAME, enterFrameHandler);
    //This function is called in each frame
    function enterFrameHandler(e:Event):void {
        //Calculate the angle speed according to mouse position
        angleSpeed = (mouseY - centerY) / 5000;
        //Loop through the vector
        for (var i:uint = 0; i < NUMBER_OF_ITEMS; i++) {
            //Save the item to a local variable
            var item:Item=itemVector[i];
            //Update the angle
            item.angle+=angleSpeed;
            //Set the new coordinates
            item.x=centerX+radiusX*Math.sin(item.angle);
            item.y=centerY+radiusY*Math.cos(item.angle);
            //Calculate the vertical distance from centerY to the item
            var dx:Number=centerX-item.x;
            //Scale the item according to vertical distance
            //item.scaleX = (dx / radiusX);
            //If we are above centerY, double the y scale
            if (item.x<centerX) {
                item.scaleX*=1;
            //Set the x scale to be the same as y scale
            item.scaleY=item.scaleX;
            //Adjust the alpha according to y scale
            item.alpha=item.scaleX+1.9;

  • Need to rotate image around the axis

    Hi, I'm using this ti rotate the image, it works but I need to rotate the image around the center of the image, center axis.
    I don't understad what is the meaning of values 50 and 60, and what I need to write instead?
    public void paintComponent_new(Graphics g){
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D)g;
    g2.rotate (Math.toRadians(angle),60,60);
    g2.drawImage(pre.getImage(), 50, 50, this);
    g2.dispose();
    }

    Using that method, the rotation occurs around the point (x,y). The rotation is a measure of theta radians. One radian translates to 180/PI degrees; thus, there are 2*PI radians in 360 degrees.
    So if, for example, you wanted to rotate round the point (40,40) exactly 90 degrees, you could use
    Graphics2D g2d = ...;
    g2d.rotate(Math.PI/2, 40, 40);Note that this rotation is a translation of the view, not a translation of any contents. That means that anything drawn to the Graphics2D object will appear as if rotated in that fashion. Therefore, if you draw an image onto that Graphics2D object after calling rotate in that fashion, the image will be rotated as well.

  • Rotating objects in a table

    I have dropped an object (picture) into a pages document. Then I rotated it with 90°. When I copy or drop the picture into the cell of a table, it is rotated back into the original orientation and I cannot rotate it any more.
    Is there a possibility to rotate objects in table cells?

    The only way I can find to do it actually doesn't insert the graphic in the table per se. It's a workaround that may or may not suit your purposes. FWIW:
    1. Click outside the margin and insert a shape (square) as Fixed on Page and in the Wrap Inspector deselect Object Causes Wrap.
    2. Drag it over the cell you want the picture in and size it to fit the cell.
    3. In the Graphic Inspector's drop down Fill menu, choose Image Fill and choose your picture (rotated as you want it). In the drop down menu below the Fill menu, select either Scale to Fit or Scale to Fill, as necessary.
    4. When you have the picture situated as you want it, click on the picture and shift click on the table and from the Arrange menu select Group.
    At this point you can set it for Moves With text if that is what you need, or leave it as Fixed on Page and position it where you want it.
    Hope this helps.
    Walt

  • Blending objects around a polygon

    Hi,
    Is there any way in indesign to blend the objects around a rectangle, circle, polygon etc (like in corel draw) ?
    Is there any to create custom presets for strokes which should take any kind of objects ?
    I require it for creating attractive frame borders

    Yeah, looking at the sample file that you posted, you want to use Adobe Illustrator brushes to achieve that result. Here's a free video you can watch on how to do it http://tinyurl.com/myu5r2f. Once you create the artwork, you can place it into your InDesign file as a graphic.

  • Business Object and Global Classes

    is there any link between the Business Objects And Global Classes?
    Sameer

    Hi,
    BO is basicallya reporting tool...
    and now BO will be used for reporting on BW.....
    Check these details BW and BO integration..
    follow the link
    www.scribd.com/doc/7805501/BI-BO-Integration
    http://www.jonerp.com/content/view/170/46/
    Have a look at this:
    http://www.businessobjects.com/products/dataintegration/dataintegrator/sap.asp
    This link has lots of PDF documents between SAP and Business object:
    http://www.businessobjects.com/solutions/sap/default.asp
    Also check:
    http://www.dmreview.com/article_sub.cfm?articleId=2839
    http://searchsap.techtarget.com/general/0,295582,sid21_gci1077480,00.html
    check the foll links.
    http://www.businessobjects.com/solutions/sap/
    http://72.14.235.104/search?q=cache:A5mUGEzyGLUJ:www.businessobjects.com/pdf/solutions/xi_sap_insight.pdfBW%26BUSINESSOBJECTS&hl=en&gl=in&ct=clnk&cd=5
    http://www.buisnessobjects.com/news/press/press2003/cust_sapbw_webseminar.asp
    http://www.buisnessobjects.com/solutions/enterprise_solutions/operational_bi.asp
    http://www.businessobjects.com/products/
    http://help.sap.com/saphelp_erp2005/helpdata/en/a4/1be541f321c717e10000000a155106/frameset.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/30/8d27425005ca7ee10000000a1550b0/frameset.htm
    regards
    Venkat...
    Edited by: Venkata Narayana Jakkampudi on Dec 30, 2008 12:57 PM

  • Is it possible to create a rotating object in Muse?

    Is it possible to create a rotating object in Muse? I have a round logo and I want it rotating.

    HI
    If you are looking for an animated logo, which rotates in 360 degree, it is not possible in Muse. You can create an animation in Edge animate and import the animation in Adobe muse.,

  • A program that can rotate objects

    Is there any done program that can rotate objects from graph?
    I am not a programmer I just need to use that for mathematics.
    Any help will be appreciated.

    I'm not sure what you are asking for. You can rotate an image with [url http://java.sun.com/j2se/1.4.2/docs/api/java/awt/geom/AffineTransform.html]AffineTransform. You can look at the source for it in src.zip. You can [url http://onesearch.sun.com/search/developers/index.jsp?col=devforums&qp_name=Algorithms&qp=forum%3A426&qt=rotate]search for algorithms.

  • How do I view page margins and drag objects around to fit?

    How do I view page margins and drag objects around to fit?

    Hi Sime,
    Some ideas for workarounds now that Numbers 3 has lost Page Setup, Print View and Layout View.
    1. Numbers 2.3 is still on your computer unless you deleted it. Look in your Applications folder for the iWork '09 folder. Drag the Numbers '09 (Numbers 2) icon to your Dock. It will become an Alias. Right click (or control click) on it then Options > Keep in Dock. You might actually enjoy running both versions at the same time, to compare features. Just be careful which version you are running before you edit and save.
    2. Use Numbers 3 to export a document 'backwards' to Numbers 2. Be aware that features lost in Numbers 3 may not be restored by exporting 'backwards' to Numbers 2.
    3. In Numbers 3 > Preferences > Rulers
    Those Guides help you to align objects with each other.
    4. Menu > View > Show Rulers. This will show zero for the top or right left margin. Then drag a ruler guide from top or left.
    More hints on workarounds here:
    https://discussions.apple.com/message/23622372#23622372
    What has been GAINED in Numbers 3 is here:
    https://discussions.apple.com/thread/5473882?start=45&tstart=0
    If you want to see what has been lost in Numbers 3, go here:
    https://discussions.apple.com/thread/5470448?start=240&tstart=0
    Regards,
    Ian.
    Message was edited by: Yellowbox. Oops, This will show zero for the top or *right* margin. Mirror image this to *left* margin

Maybe you are looking for