The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


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