dcsimg
A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 37

Thread: 3D CUBE with colored sides - posted for the TENTH time

  1. #1
    Banned
    Join Date
    Oct 2006
    Posts
    86

    Re.3d Cube?

    Can anyone help me .I have the Script to make an opaque 3D cube but i really want to have one with all the Sides Filled In.Prefurably
    One Side Bright Yellow
    One Side Bright Green
    One Side Bright Blue
    One Side Bright Red
    I dont mind the other colors used as long as it looks like a Rubix Cube.
    Also,I dont really want it locked to the Cursor

    Alan
    I HATE TO ASK BUT I HAVE DESPERATELY BEEN TRYING TO ADD MY BEGIN FILL AND END FILL BUT WITH LITTLE EFFECT

  2. #2
    Banned
    Join Date
    Oct 2006
    Posts
    86

    Rwe 3dcubes

    Can anyone help me .I have the Script to make an opaque 3D cube but i really want to have one with all the Sides Filled In.Prefurably
    One Side Bright Yellow
    One Side Bright Green
    One Side Bright Blue
    One Side Bright Red
    I dont mind the other colors used as long as it looks like a Rubix Cube.
    Also,I dont really want it locked to the Cursor

    Alan
    I HATE TO ASK BUT I HAVE DESPERATELY BEEN TRYING TO ADD MY BEGIN FILL AND END FILL BUT WITH LITTLE EFFECT

  3. #3
    supervillain gerbick's Avatar
    Join Date
    Jul 2000
    Location
    undecided.
    Posts
    18,978
    Ok... let's start off with the rules.

    Ask your questions once in the most appropriate location/forum. Once. Per the Flashkit Rules...

    Now, you want a segmented, non-animated 3D rubix cube? What tools do you have access to?

    [ Hello ] | [ gerbick ] | [ Ω ]

  4. #4
    Banned
    Join Date
    Oct 2006
    Posts
    86

    Re 3dcube

    Hi,thanks For Replying.i Dont Fully Understand Ur Question About What Tools I Have Access To.if I Just Us Normal Flash 5 With Its Standard Tools
    Alan

  5. #5
    Banned
    Join Date
    Oct 2006
    Posts
    86

    Re 3dcube With Different Color Sides

    I have the Script to make a Transparent 3d Rotating Cube but i want want one with colored sides.I tried adapting my script by using "begin fill" and "end fill" but could not do it.Could anyone help.Alan

  6. #6
    Banned
    Join Date
    Oct 2006
    Posts
    86

    3d cube with colored sides?

    I have the Script to make a Transparent 3d Rotating Cube but i want want one with colored sides.I tried adapting my script by using "begin fill" and "end fill" but could not do it.Could anyone help.Alan

  7. #7
    Busy doing nothing Boris the Frog's Avatar
    Join Date
    Jan 2001
    Location
    Derby, UK
    Posts
    305
    Could you post some code?
    --------------------------------------------------
    ‘There is no emoticon to express how I am feeling’ - Comic Book Guy
    There's an effective, simple solution to carbon sequestration... it's called 'coal', so leave it alone!
    There's an effective, simple solution to carbon capture....it's called 'trees', so plant some!

  8. #8
    Banned
    Join Date
    Oct 2006
    Posts
    86

    Re Cube

    Hi Boris.yes I Shall Post The Code To U Tomorrow As I Am Not On The Net At Home And Use Cafes.

  9. #9
    supervillain gerbick's Avatar
    Join Date
    Jul 2000
    Location
    undecided.
    Posts
    18,978
    By tools, I mean software.

    And do you have any 3D software. To create something like a rubix cube and you want to rotate it, you have three methods immediately available to you that I can bring up.

    3D model within a 3D program
    3D model via ActionScript
    Fake 3D

    Well... here's a fourth. Get a 3D rubix cube clip/model.

    Now... what software do you have that can help you accomplish this task?

    [ Hello ] | [ gerbick ] | [ Ω ]

  10. #10
    supervillain gerbick's Avatar
    Join Date
    Jul 2000
    Location
    undecided.
    Posts
    18,978
    Alan Robotkin... I don't know how you keep posting the same thread, the same thing, over and over in different places in Flashkit over and over but it's against the rules, it's annoying, and above all it's going to stop.

    One way or the other.

    I've insisted that you read the rules. Allow me to make them very clear to you right now. And this is your absolute last warning on this subject. This happens again, you will have your right to post at Flashkit removed permanently.

    The rules state that you do not multiple post your one inquiry on the same subject across multiple threads ever again. You have historically done this over and over.

    It stops now.

    [ Hello ] | [ gerbick ] | [ Ω ]

  11. #11
    Banned
    Join Date
    Oct 2006
    Posts
    86

    Re Cube

    HERE IS THE SCRIPT U WANTED BORIS
    //you need two movie clips in the library
    //one called "line"which is 100 pixels and hairline and extends diagonally from the centre of the movie clip
    //and one called "point"which is a simple dot
    // both should have linkages set to export
    //this next script is in main timeline
    // create an array of the 8 points in a cube
    function makePoints() {
    points = new Array();
    points[0] = {x: 30, y: 30, z: 30};
    points[1] = {x: -30, y: 30, z: 30};
    points[2] = {x: -30, y: -30, z: 30};
    points[3] = {x: 30, y: -30, z: 30};
    points[4] = {x: 30, y: -30, z: -30};
    points[5] = {x: 30, y: 30, z: -30};
    points[6] = {x: -30, y: 30, z: -30};
    points[7] = {x: -30, y: -30, z: -30};

    // create eight movie clips for cube corners
    for(i=0;i<points.length;i++) {
    attachMovie( "point", "point"+i, i )
    }
    }

    // create an array of the 12 lines in a cube
    function makeLines() {
    lines = new Array();
    lines[0] = {p1: 0, p2: 1};
    lines[1] = {p1: 1, p2: 2};
    lines[2] = {p1: 2, p2: 3};
    lines[3] = {p1: 3, p2: 0};
    lines[4] = {p1: 4, p2: 5};
    lines[5] = {p1: 5, p2: 6};
    lines[6] = {p1: 6, p2: 7};
    lines[7] = {p1: 7, p2: 4};
    lines[8] = {p1: 0, p2: 5};
    lines[9] = {p1: 1, p2: 6};
    lines[10] = {p1: 2, p2: 7};
    lines[11] = {p1: 3, p2: 4};

    for(i=0;i<lines.length;i++) {
    attachMovie( "line", "line"+i, 50+i )
    }
    }

    // take 3d coordinates and convert to screen location
    function plotPoint(object) {
    // get coordinates from object
    x = object.x;
    y = object.y
    z = object.z;

    // determine distance from center
    radius = Math.sqrt (x*x+y*y);

    // compute first angle
    if (x == 0) angle = Math.atan(1000000);
    else angle = Math.atan(y/x);
    if (y < 0) angle += Math.PI;

    // add rotation
    angle += rotation;

    // compute new coordinates
    realx = radius*Math.cos(angle);
    realz = radius*Math.sin(angle);
    realy = z;

    // determine new distance from center
    radius = Math.sqrt(realy*realy+realz*realz);

    // compute second angle
    if (realz == 0) angle = Math.atan(1000000);
    else angle = Math.atan(realy/realz);
    if (realz < 0) angle += Math.PI;

    // add angle of plane
    angle += plane;

    // compute screen coordinates
    screenx = realx;
    screeny = radius*Math.sin(angle);
    screenz = radius*Math.cos(angle);

    // center on screen
    screenx += 275;
    screeny += 200;

    // return object
    return({x:screenx,y:screeny,z:screenz});
    }

    // loop through points and set corners of cube
    function drawPoints() {
    for(i=0;i<points.length;i++) {
    loc = plotPoint(points[i]);
    this["point"+i]._x = loc.x;
    this["point"+i]._y = loc.y;
    this["point"+i]._alpha = loc.z+100;
    }
    }

    // loop through lines and set edges of cube
    function drawLines() {
    for(i=0;i<lines.length;i++) {
    loc1 = plotPoint(points[lines[i].p1]);
    loc2 = plotPoint(points[lines[i].p2]);
    this["line"+i]._x = loc1.x;
    this["line"+i]._y = loc1.y;
    this["line"+i]._xscale = loc2.x-loc1.x;
    this["line"+i]._yscale = loc2.y-loc1.y;
    this["line"+i]._alpha = loc1.z+100;
    }
    }

    // reposition cube every frame
    function reposition() {
    rotation += (275-_xmouse)/1000;
    plane = -(200-_ymouse)/100;
    drawPoints();
    drawLines();
    }

    // call initial functions and stop on this frame
    rotation = 0;
    makePoints();
    makeLines();
    stop();
    //this next bit is attached to a seperate actions movie clip which is off screen
    onClipEvent(enterFrame) {
    _root.reposition();
    }

  12. #12
    Banned
    Join Date
    Oct 2006
    Posts
    86

    To Gerbick

    I Dont Have Any Access To 3d Tools And Was Hoping To Acheive End Result Via Actionsript

  13. #13
    supervillain gerbick's Avatar
    Join Date
    Jul 2000
    Location
    undecided.
    Posts
    18,978
    Why can't you follow one simple rule?

    I've had to delete your script code that you posted in another thread in Flash ActionScript.

    If you can search to post stuff multiple times, just follow the rules and post it once

    You are close to being a spammer dude.

    [ Hello ] | [ gerbick ] | [ Ω ]

  14. #14
    Banned
    Join Date
    Oct 2006
    Posts
    86

    Re Soory

    Yes I Realised I Posted It In The Wrong Place Just Afterwards

  15. #15
    Banned
    Join Date
    Oct 2006
    Posts
    86

    3d Cube

    HERE IS THE SCRIPT FOR A TRANSPARENT CUBE.Can anyone help me adapt it so that all sides of the cube are different colors?
    //you need two movie clips in the library
    //one called "line"which is 100 pixels and hairline and extends diagonally from the centre of the movie clip
    //and one called "point"which is a simple dot
    // both should have linkages set to export
    //this next script is in main timeline
    // create an array of the 8 points in a cube
    function makePoints() {
    points = new Array();
    points[0] = {x: 30, y: 30, z: 30};
    points[1] = {x: -30, y: 30, z: 30};
    points[2] = {x: -30, y: -30, z: 30};
    points[3] = {x: 30, y: -30, z: 30};
    points[4] = {x: 30, y: -30, z: -30};
    points[5] = {x: 30, y: 30, z: -30};
    points[6] = {x: -30, y: 30, z: -30};
    points[7] = {x: -30, y: -30, z: -30};

    // create eight movie clips for cube corners
    for(i=0;i<points.length;i++) {
    attachMovie( "point", "point"+i, i )
    }
    }

    // create an array of the 12 lines in a cube
    function makeLines() {
    lines = new Array();
    lines[0] = {p1: 0, p2: 1};
    lines[1] = {p1: 1, p2: 2};
    lines[2] = {p1: 2, p2: 3};
    lines[3] = {p1: 3, p2: 0};
    lines[4] = {p1: 4, p2: 5};
    lines[5] = {p1: 5, p2: 6};
    lines[6] = {p1: 6, p2: 7};
    lines[7] = {p1: 7, p2: 4};
    lines[8] = {p1: 0, p2: 5};
    lines[9] = {p1: 1, p2: 6};
    lines[10] = {p1: 2, p2: 7};
    lines[11] = {p1: 3, p2: 4};

    for(i=0;i<lines.length;i++) {
    attachMovie( "line", "line"+i, 50+i )
    }
    }

    // take 3d coordinates and convert to screen location
    function plotPoint(object) {
    // get coordinates from object
    x = object.x;
    y = object.y
    z = object.z;

    // determine distance from center
    radius = Math.sqrt (x*x+y*y);

    // compute first angle
    if (x == 0) angle = Math.atan(1000000);
    else angle = Math.atan(y/x);
    if (y < 0) angle += Math.PI;

    // add rotation
    angle += rotation;

    // compute new coordinates
    realx = radius*Math.cos(angle);
    realz = radius*Math.sin(angle);
    realy = z;

    // determine new distance from center
    radius = Math.sqrt(realy*realy+realz*realz);

    // compute second angle
    if (realz == 0) angle = Math.atan(1000000);
    else angle = Math.atan(realy/realz);
    if (realz < 0) angle += Math.PI;

    // add angle of plane
    angle += plane;

    // compute screen coordinates
    screenx = realx;
    screeny = radius*Math.sin(angle);
    screenz = radius*Math.cos(angle);

    // center on screen
    screenx += 275;
    screeny += 200;

    // return object
    return({x:screenx,y:screeny,z:screenz});
    }

    // loop through points and set corners of cube
    function drawPoints() {
    for(i=0;i<points.length;i++) {
    loc = plotPoint(points[i]);
    this["point"+i]._x = loc.x;
    this["point"+i]._y = loc.y;
    this["point"+i]._alpha = loc.z+100;
    }
    }

    // loop through lines and set edges of cube
    function drawLines() {
    for(i=0;i<lines.length;i++) {
    loc1 = plotPoint(points[lines[i].p1]);
    loc2 = plotPoint(points[lines[i].p2]);
    this["line"+i]._x = loc1.x;
    this["line"+i]._y = loc1.y;
    this["line"+i]._xscale = loc2.x-loc1.x;
    this["line"+i]._yscale = loc2.y-loc1.y;
    this["line"+i]._alpha = loc1.z+100;
    }
    }

    // reposition cube every frame
    function reposition() {
    rotation += (275-_xmouse)/1000;
    plane = -(200-_ymouse)/100;
    drawPoints();
    drawLines();
    }

    // call initial functions and stop on this frame
    rotation = 0;
    makePoints();
    makeLines();
    stop();
    //this next bit is attached to a seperate actions movie clip which is off screen
    onClipEvent(enterFrame) {
    _root.reposition();
    }

  16. #16
    supervillain gerbick's Avatar
    Join Date
    Jul 2000
    Location
    undecided.
    Posts
    18,978
    Quote Originally Posted by Alan Robotkin
    Yes I Realised I Posted It In The Wrong Place Just Afterwards
    Erm... no you didn't.

    You posted it again.

    That's 9 times. Post this one more time, and you're going to have a week long break to figure out what you might be doing wrong.

    [ Hello ] | [ gerbick ] | [ Ω ]

  17. #17
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    you're lucky. I'd have banned you by now.

  18. #18
    Junior Member
    Join Date
    Jun 2006
    Posts
    29
    Quote Originally Posted by gerbick
    Erm... no you didn't.

    You posted it again.

    That's 9 times. Post this one more time, and you're going to have a week long break to figure out what you might be doing wrong.
    lol... sorry had to get that out of my system.

  19. #19
    Banned
    Join Date
    Oct 2006
    Posts
    86

    3D CUBE with colored sides?

    I have the script for a 3d cube that is traNsparent and have tried to use "begin fill" and "end fill" to make it have colored sides,but i have not managed to acheive it.Can any one give me any advice or perhaps suggest a book i could read on making 3d in ACTIONSRIPT OR IN INDEED IF IT IS POSSIBLE AT ALL TO ACHEIVE A COLORED CUBE WITHOUT USING ANY 3D TOOLS BUT JUST USING ACTIONSCRIPT.SORRY I NEVER BUMPED MY OTHER THREAD ON THE SUBJECT BUT I FORGOT TO ASK ABOUT THE BOOK.
    P.S IF I DONT REPLY TO YOUR ANSWER STRAIGHT AWAY IT IS BECAUSE I AM NOT ON THE NET AT HOME BUT I WILL GET BACK TO U WITHIN 24 HOURS
    ALAN

  20. #20
    supervillain gerbick's Avatar
    Join Date
    Jul 2000
    Location
    undecided.
    Posts
    18,978
    This is the same thread as your other NINE threads on the same subject that I've had to compile?

    Ok. Since you are that dang insistent on posting this over and over... and despite multiple warnings why don't you just alter the Alpha and drop the percentage away from 100% to a lesser amount for transparency.

    That will work if you are using solids to make up the movieclips to make up the 3D box.

    I will clump this thread into your other one. AGAIN

    [ Hello ] | [ gerbick ] | [ Ω ]

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