Professional Web Applications Themes

3D Joystick - Macromedia Director 3D

Hi all, I'm trying to create a 3D joystick lever, i.e. those inside a crane. I want the user to be able to click and drag the lever in the 3D space/world. Any tips/demos would be appreciated! Cheers, Andy...

  1. #1

    Default 3D Joystick

    Hi all,
    I'm trying to create a 3D joystick lever, i.e. those inside a crane. I want
    the user to be able to click and drag the lever in the 3D space/world.

    Any tips/demos would be appreciated!

    Cheers, Andy



    AndrewNock Guest

  2. #2

    Default 3D Joystick

    Hi all,
    I'm trying to create a 3D joystick lever, i.e. those inside a crane. I want
    the user to be able to click and drag the lever in the 3D space/world.

    Any tips/demos would be appreciated!

    Cheers, Andy



    AndrewNock Guest

  3. #3

    Default Re: 3D Joystick

    Here's a rough outline of one customized way to do it:
    -- Create the full range of animation for the lever in your 3D authoring
    program (Max, Maya).
    -- In lingo, set the lever model's keyframeplayer.playrate to 0.0 so it
    doesn't move.
    -- use _mouse.mouseloc, onMouseDown and modelsUnderLoc on a frequent interval
    to detect if you've clicked the lever. check out the help on modelsUnderLoc.
    -- if you're mouse-down on the lever, use spriteSpaceToWorldSpace to map the
    current cursor location to a location in the world.
    -- set the lever model's keyframeplayer.currenttime property according to the
    result of spriteSpaceToWorldSpace... this will set the lever position according
    to the cursor position.

    hope it helps some.

    tedalde2 Guest

  4. #4

    Default Re: 3D Joystick

    Thanks for that - I was hoping there might be a way that I could 'drag' the model, but hold the bottom of the lever using its pivot point.... but thats as far as i've thought....
    AndrewNock Guest

  5. #5

    Default Re: 3D Joystick

    If I understand what you're intending, this should be possible with proper use
    of the 3D rotate command. Models normally rotate arond their center but you
    should be able to get it to rotate along the X & Z axes using the base as a
    fixed centre of rotation.

    hth

    johnAq

    johnAq Guest

  6. #6

    Default Re: 3D Joystick

    I agree with johnAq. I would advise against attempting to use keyframe
    animations for the joystick movement, as it won't allow for full free 2-way
    movement.

    In your 3d app, make sure your joystick's pivot point is set at its base, so
    that it rotates correctly.

    To detect clicks on the top of the joystick only, make the top of your
    joystick a separate model, and parent it to the rest of the joystick. You will
    then be able to use 'modelsUnderLoc' to detect if the joystick top has been
    clicked.

    When clicked, you need to store the mouse position, then, while the mouse
    button is still held down, examine the difference between the current mouse
    position and the stored mouse position. This will give you an H & V value for
    the offset from where the user intially clicked.

    You can then use this H and V value for setting the joystick's rotation
    values. You'll need to experiment to find which of the joystick model's X Y & Z
    axis correspond to your mouse's H and V values.

    You may find it yields more predictable results if you use variables for your
    joystick's rotation values, and use the mouse H and V to adjust your rotation
    variables, *then* apply the rotation variables as absolute rotation values for
    your model. This will probably make it easier to specify the min and max limits
    for the joystick movement too.

    Hope this helps!

    - Ben

    duckets Guest

Similar Threads

  1. joystick
    By kjop in forum Macromedia Flash
    Replies: 2
    Last Post: June 2nd, 09:49 AM
  2. Joystick Interface
    By S|MuLaTOR webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 3
    Last Post: November 23rd, 06:51 PM
  3. Virtual PC 6.1: USB joystick?
    By Ian in forum Mac Applications & Software
    Replies: 0
    Last Post: August 28th, 03:06 PM
  4. OS X driver for ADB joystick?
    By Mcleanzep in forum Mac Applications & Software
    Replies: 0
    Last Post: July 13th, 01:52 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139