dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Pseudo 3D scaling driving me nuts

  1. #1
    Junior Member
    Join Date
    Oct 2001
    Posts
    23

    Pseudo 3D scaling driving me nuts

    Greetings worthy maths gurus,

    This possibly has a pretty simple solution, but right now it's driving me nuts.

    The basic idea is this:

    1. A field of similar objects, all randomly placed.
    2. Clicking an object centers the object on the screen by moving the whole field, and zooms in on the field by scaling the clicked object to a predetermined size.
    3. Clicking another object repeats the process.

    In the attached file, everything works fine - but only step 1 and 2. Step 3 just doesn't quite make it, but is almost there. My calculation isn't quite right and clip doesn't center properly.

    I have stripped out all of the irrelevant code from this, and just left the core of the concept intact. Hopefully someone smarter than me can see where it's broken!



    The .fla is also here: www.australis.net.au/~mattc/shock/field.zip

  2. #2
    Junior Member
    Join Date
    Oct 2001
    Posts
    23
    The file is attached this time
    Attached Files Attached Files

  3. #3
    Junior Member
    Join Date
    Oct 2001
    Posts
    23
    Still can't work this out

    I have isolated the problem, but am still having trouble with it. I need to be able to calculate the distance the field should move as the clip changes scale. This works the first time, when the clip is scaled to 100%, but I can't work out how to make it work when the clip is scaled to something other than 100% (i.e. when it has already moved and scaled before).

    * wishing for jbum to put me out of my misery *

  4. #4
    Senior Member
    Join Date
    May 2001
    Posts
    1,838
    Becareful, the target center is not (0,0) but where _root.crosshair is; So,

    changeX = offsetX*((changeScale+originalScale)/100)*-1-originalX+_root.crosshair._x;

    changeY = offsetY*((changeScale+originalScale)/100)*-1-originalY+_root.crosshair._y;

  5. #5
    Junior Member
    Join Date
    Oct 2001
    Posts
    23
    Yippee!

    Thank you - I had the feeling there was something fundamental I was overlooking. This works perfectly, thanks.

  6. #6
    www.stylefrogcreative.com
    Join Date
    Apr 2001
    Posts
    100

    Help with a similar problem...

    Hi there,

    I wonder if you guys can be of any help - I face a similar problem but I need my spheres to rotate around a central point and bring the clicked sphere to the front of the screen.

    Basically my set of spheres need to maintain their tetrahedron formation - please see attached, I dont think I'm far off now but jut need that final push! Any help would be more than appreciated - got a client waiting to see this working on Monday!!!

    Many, many thanks!
    Attached Files Attached Files
    Stylefrog

    matt@stylefrogcreative.com
    http://www.stylefrog.net
    http://www.stylefrogcreative.com

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