dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: need a 3D code

  1. #1
    Junior Member
    Join Date
    Apr 2003
    Posts
    5

    need a 3D code

    Ok, this one will seem a little wierd, im trying to get an instance to move in a 3D static (does not move) back ground. How would i get it so that when the instance moves further away, it becomes smaller, and will move slower. The instance will be a person walking, and will be controllable to the user.

    If you could help with this lil prob., then women will want to have sex with you

  2. #2
    Opu Nui
    Join Date
    Jan 2003
    Location
    I'd rather be in Hawaii
    Posts
    79
    The "z" distance is a linear relationship, so to do that, relate the y position of the mouse to the x & y scale of the movie clip.

    setProperty("movie", _yscale, _ymouse);
    setProperty("movie", _xscale, getProperty("movie", _yscale));

    To acheive the paralax effect (objects moving slower when far away, and vice versa) relate the x position of the mouse to the scale of the movie clip. This determines the x position of the movie clip.

    xpos = getProperty("movie", _xscale)*(_root._xmouse)/(550);

    Note: The Mouse position should be divided by the Movie size, otherwise the clip will shoot off of the screen.

    Hope this helps.

    -Swim'nSasquatch

  3. #3
    Senior Member
    Join Date
    Jan 2002
    Posts
    368
    if you keep using getProperty and setProperty, women will not want to have sex with you.

  4. #4
    Opu Nui
    Join Date
    Jan 2003
    Location
    I'd rather be in Hawaii
    Posts
    79
    That's too bad. , but good news for my wife

  5. #5
    Senior Member
    Join Date
    May 2001
    Posts
    1,838
    I like to use this equation:
    _x=(x-x0)*N/(M+z)-PX0;

    For a static picture, we need to calculate out the co-efficients:
    x0,N,M and PX0;

    I draw a 3d sqaure in the picture and pick 4 points to solve the equation mentioned above.

    Here is the fla if anyone is interested.
    Attached Files Attached Files

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center