Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 2 of 2

Thread: matrix3D rotation being odd.

  1. #1

    matrix3D rotation being odd.

    Situation:
    Hello, I'm trying to make a "room" in flash in which you can "move" around in.
    I set up the room with flash cs4 3d functionality.

    SWF:
    http://www.swfcabin.com/open/1257388415
    (use arrows)

    Problem:
    Rotation of the camera moves the room along X and Y axis.

    ActionScript:
    Code:
    var startX:int=room.x;
    var startY:int=room.y;
    var startZ:int=room.z;
    stage.addEventListener(KeyboardEvent.KEY_DOWN,keyDownHandler);
    function keyDownHandler(event:KeyboardEvent):void {
    
        var curX:int=room.x;
        var curY:int=room.y;
        var curZ:int=room.z;
        var cameraX:int=curX-startX;
        var cameraY:int=curY-startY;
        var cameraZ:int=curZ-startZ;
        trace(cameraX+" "+cameraY+" "+cameraZ);
        
        
        if (event.keyCode==Keyboard.LEFT) {     
            room.transform.matrix3D.appendRotation(10, Vector3D.Y_AXIS, new Vector3D(cameraX+startX,cameraY+startY,cameraZ+startZ));
        }
        if (event.keyCode==Keyboard.RIGHT) {
            room.transform.matrix3D.appendRotation(-10, Vector3D.Y_AXIS, new Vector3D(cameraX+startX,cameraY+startY,cameraZ+startZ));
        }
        if (event.keyCode==Keyboard.UP) {
            room.z-=10;
    
        }
        if (event.keyCode==Keyboard.DOWN) {
            room.z+=10;
        }
        
    
    }
    FLA:
    http://rapidshare.com/files/302587006/room2.fla

    Thanks for your time and expertise.
    Last edited by Synn; November 4th, 2009 at 11:19 PM.

  2. #2
    Bump, anyone out there?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012