A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Circles as fake spheres: trouble rotating in AS3.

  1. #1
    Junior Member
    Join Date
    Aug 2009
    Posts
    4

    Circles as fake spheres: trouble rotating in AS3.

    I'm using circle sprites with radial gradients to represent spheres.. pretty standard. I've got an empty sprite _holder, and I've added all the circles as subchilds to that, so that I can move the "camera" by just rotating holder (e.g. _holder.rotationY += 4; or something).

    Trouble is: when I rotate the circles, and you see them edge on, they don't look like spheres anymore! I need a way of keeping the circles facing forwards... I tried onEnterFrame (circles).rotationY = 0 but that didn't work. I don't know if I need to use Matrix3D or something, or if I should abandon this altogether and try Papervision.

    For a bit of context... I've only just started using Flash, and I learnt AS2 to start with because we only had Flash 8 at work, but in the last week I've been learning AS3 since buying my own copy of CS4, and I'm still coming up to speed with it. As for what I'm trying to do -- I'm trying to create a 3D model of graphite that a user can rotate, with some dynamic effects too (e.g. bonds as springs, etc.) I've been learning everything from Keith Peter's AS3 animation books, which're excellent..

    I have tried searching for this, but all I can find is how to make "real" spheres with triangles etc. which is far too complicated/computationally expensive for me. Still, apologies if this has already been answered before.

    Thanks for any help.

  2. #2
    Member
    Join Date
    Nov 2003
    Location
    Tennessee
    Posts
    49
    You need to figure out how to set the rotation of the circle(s) to the direction of the camera. I can't help with this. My knowledge of Papervision is quite limited. Sorry.
    GetLives Arcade: Play games, nothing else.
    This site is nothing but Flash-powered games. If you're bored, try a few of them.

  3. #3
    Palindrome emordnilaP Diniden's Avatar
    Join Date
    Feb 2008
    Posts
    230
    Here's a great idea on the matter. First make a radial gradient going from white to white with alpha of 0. This gradient will be on the top layer at all times and will be the "shine" off of the sphere.

    Now next lower layer make a mask layer and put a circle there.

    Inside the layer under the mask, put a textured looping sheet. Depending on the roll and direction the sphere goes, you can move and rotate this texture under the mask to simulate the motion.

    Getting the motion to properly match up with what's going on could be a bit tricky but it could turn out interesting. In fact, this idea has encouraged me to give it a shot in the future

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