i want a script to move objects smoothly

Ask a Question related to Macromedia Flash Actionscript, Design and Development.

  1. #1

    Default i want a script to move objects smoothly

    hey folks:

    i've been doing some animation and one problem i have repeatedly is that i want to mimic REAL 3d movement....in particular, i want to move objects by the user as they would appear to move if the user was moving with some constant velocity and a 90 degree field of view (pi/2). this could be really cool as it might help a lot for creating realistic movement for 3d type space games or something.

    i believe TRIGONOMETRY will be my salvation but my math skills are somewhat stunted these days.

    if i assume the following:
    1) some object on the screen with dimensions X and Y (in meters?) at distance D moving with velocity V (in a more general case, this would be a 3d velocity with X, Y, and Z components).
    2) i have a 90 degree field of view

    at one point, i did a simplified approximation of this problem...i assumed the object (a planet in this case) would be flying toward the viewer but the viewer was going to go some 10 meters to one side of the object.

    anyways....has anyone done something like this? i've seen some animations which are obviously using formulas of some kind for motion as they are so smooth and realistic looking.




    sneakyimp webforumsuser@macromedia.com Guest

  2. Similar Questions and Discussions

    1. Variable do not move from on script to the another one.
      Hello to all I just download the WAMP (apache-mysql-php) package. This package work with PHP5. Aktually I can't move on variable ($id) the...
    2. move objects to new layer
      Is there a quick way to move objects to a new layer in situ? Can make new layer and cut and paste, but objects move. Collecting in new layer seems...
    3. library objects move off page
      I have been experiencing a strange bug on Freehand MXa (v11.02 on Mac os 10.3.4) ... I am constructing a drawing using various library elements I...
    4. Move objects to current layer
      Is there a keyboard short cut to do this in FHMX?
    5. How do I run video smoothly?
      My director project incorporates several mpeg video clips which are linked externally and displayed Direct To Stage. However, just before the videos...
  3. #2

    Default Re:i want a script to move objects smoothly

    Hi sneakyimp,

    I'm afraid if your basic trig skills are waning, you will have major problems with "real" 3D. These require quite complex vector and matrix calculations, even without lighting and texturing....

    Perhaps what you are trying to do, or imagine, is using flash's normal tools (rotation, tweening, resizing of clips etc) to create a clever illusion of 3d movement?

    With planets its not so bad because these are spherical, and from any angle on a 2D surface (the screen) these will look the same - i.e. like a circle basically.

    Your movement of a planet may go something like this:

    1) Make a planet clip with a nice drawing/animation of a planet and place it on the stage.
    2) Make it very small and near the center in frame 1
    3) Make a keyframe in frame 30, and in this frame resize the planet to 300% and place it just off the side of the stage.
    4) RIght click between the keyframes (e.g. frame 20) and select motion tween.

    Hey presto. looks like 3D....

    I have attached a clip of the first part of a movie I am making using only flash tools and a bit of scripting... you can do some cool stuff without doing "3D".

    Hope it helps,
    Pea

    [url]http://webforums.macromedia.com/attachments/scene001a.zip[/url]


    Pea webforumsuser@macromedia.com Guest

  4. #3

    Default Re:i want a script to move objects smoothly

    i know motion tweens....the problem is that a simple motion tween doesn't look realistic. the objects tend to scale much more quickly as an objects approaches the viewer....it's a logarithmic sort of thing...things very small when far grow quickly in size as they approach...

    my statement that my math skills are not so great wasn't intended to suggest that i am incapable of implementing complex equations...i've been thru hardcore math in college...it was more go suggest that i don't want to recreate the equations from scratch...i've found this useful article but it has some flash 4 stuff that i'm trying to modernize (and apparently i'm encountering some problems with variable scope).

    [url]http://www.flashkit.com/tutorials/3D/3D_Engin-KStor-189/index.php[/url]





    sneakyimp webforumsuser@macromedia.com Guest

  5. #4

    Default Re:i want a script to move objects smoothly

    Hi,

    Not questioning your math skills at all...
    Here are a few tips that may help doing it the 'easy' way...

    1) Add more keyframes to a motion tween to slow the object down at the appropriate times - or -
    2) Use the 'ease in/ease out' features to slow the object at the appropriate times (this works really well)

    Or doing it with script:

    3) Instead of tweening, use a function to calculate the new scale based on whatever factors you want (e.g. log). Call the function giving it the distance from the viewer, and it gives you back the scale of the clip.

    Cheers,
    Pea


    Pea webforumsuser@macromedia.com Guest

  6. #5

    Default Re:i want a script to move objects smoothly

    thanks pea...


    i actually did one flash movie with planets whizzing past...i sat down and did about 3 pages of trig and it worked pretty well....i just manually scaled stuff according to calculations i put in a spreadsheet. (note: had to be careful of dividing by 0!).

    i've been trying to think of ways to do that in a flash movie where i can just put in a formula but i wasn't sure where to put my formula...in the object that's scaling? in my main movie? i was also hoping that someone else out there had done this before and just had some good advice. admittedly, i'm being a bit lazy but thought it was worth a try.

    as for the EAST IN/OUT stuff...i can't find any thing in the help file on that. where do i find it? what does it do? OH...just found it. hmmmm.....looks very interesting. THANKS! (fyi folks, EASE is found on the frame properties pane when you have selected a motion tween.




    sneakyimp webforumsuser@macromedia.com Guest

Posting Permissions

  • You may not post new threads
  • You may 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