A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: How to create 3D Spherical Effects in flash?

  1. #1
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870

    How to create 3D Spherical Effects in flash?

    It's been a long time guys...

    :3

    Fine i'll get on with the question

    [Attention, ActionScript 2.0 please.]
    Say, if I have a point - simple -and I want it to move through Flash's original 2D Coordinates system 'as if' it is moving on the surface of a spherical object. Not simple.

    The point of the effect is a small object, circling the center point of a illusionary *sphere*, and this 'circling' motion is regular (enough), so i'm not thinking about irregular circles (the ones when you have to go 3 times around the world to spin from the North Pole to the South Pole is a No no.)

    So far, after searching the web ><' I only managed to find extremely hard-to-understand ways to 'project' a coordinate, which is not what I'm looking for, by the way.

    I currently has thought up 2 ways to achieve the effect:
    1. to convert a set longitude and latitude coordinates (which seemed extremely complicated if I want the point to move in a fixed 'spherical surface speed')
    2. to first set the max distance seen on the screen, and then calculate the point's angles, and then use the Cosine graph <http://library.thinkquest.org/C0110248/geometry/graphics/trigfngraph2.jpg> twice in x and y dimensions to make it look like its moving in a spherical way. (But I cannot imagine how it could be done though)

    both of which are too difficult to imagine for a 15 year old -.-"

    Those that uses iTunes 8 would know what I am talking about, I am trying to (very badly) recreate one of its visualization effects.

    Heh, it boils my mind to even think over this stuff... *looks at planning sheet blankly*

    Xrave
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  2. #2
    Member
    Join Date
    Dec 2007
    Posts
    38
    A method (perhaps too complicated):

    use (x,y,z) to represent your point (check norm = radius of your sphere)
    and apply rotations to make your point move on the surface of the sphere.

    Your rotation can be represented by an axis (a 3D vector) passing though the center of the sphere and an angle.
    (some mathematicians invented quaternions for this purpose. Basically quaternion = unit vector + angle).
    Then, you can slightly change the direction or speed of your point by changing slightly your axis or your angle.
    Google "3D rotation axis matrix quaternion" and you should get some matrix formulas.

  3. #3
    Member
    Join Date
    Dec 2007
    Posts
    38
    see here ("Other Ways to Build a Rotation Matrix" paragraph) to see how to get a rotation matrix from axis+angle.

  4. #4
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    Quote Originally Posted by gludion
    A method (perhaps too complicated):

    use (x,y,z) to represent your point (check norm = radius of your sphere)
    and apply rotations to make your point move on the surface of the sphere.

    Your rotation can be represented by an axis (a 3D vector) passing though the center of the sphere and an angle.
    (some mathematicians invented quaternions for this purpose. Basically quaternion = unit vector + angle).
    Then, you can slightly change the direction or speed of your point by changing slightly your axis or your angle.
    Google "3D rotation axis matrix quaternion" and you should get some matrix formulas.
    Yes, however, if I use (x,y,z) points, even if it makes plotting the point(x,y) easier, it's more difficult to calculate the x,y,z, parameters...
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  5. #5
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    worked it out, just simply use cosine and sine to make a dot spin around the (0,0), and then put the mc in a movieclip and then rotate the clip to make the thing tilt. It's not as flexible as I'd like it to be, but it works...
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

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