Visualizzazione dei risultati da 1 a 1 su 1

Visualizzazione discussione

  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2006
    Messaggi
    8

    flash 3d s- sandy1.2 disegnare un cilindro

    Salve a tutti,
    ho scaricato la libreria sandy 1.2 e mi sto esercitando grazie alla guida di html.it (http://flash.html.it/guide/lezione/3205/cilindro/) nella costruzione di un cilindro. Premetto che uso Flash 8 (AS2).
    Il problema è che non riesco in nessun modo a far vedere la faccia superiore del cilindro (v/allegato).
    Qualcuno può aiutarmi?
    Di seguito il codice usato:
    Codice:
    ______________________________

    import sandy.core.data.*;
    import sandy.core.group.*;
    import sandy.primitive.*;
    import sandy.view.*;
    import sandy.core.*;
    import sandy.skin.*;
    import sandy.util.*;
    import sandy.core.transform.*;
    import sandy.events.*;

    var screen:ClipScreen;
    var world:World3D = World3D.getInstance();

    function init(Void):Void {
    screen = new ClipScreen(this.createEmptyMovieClip('screen', 1), 200, 200);
    var cam:Camera3D = new Camera3D(500, 600);
    cam.setPosition(250, 250, -500);
    cam.lookAt(0, 0, 0);

    world.addCamera(cam);
    var bg:Group = new Group();
    world.setRootGroup(bg);
    createScene(bg);
    world.render();
    }

    function createScene( bg:Group ):Void {
    createCoordinateSystem(bg, true, 1);
    //**********CILINDRO:
    var cyl = new Cylinder( 40, 40, 8, 'quad');
    cyl.setSkin( new MixedSkin(0xFEFE4E, 40, 0, 40, 1));
    // Mostro i lati nascosti (se true non si vedono)
    cyl.enableBackFaceCulling(true);
    bg.addChild( cyl );
    //**************************************************
    }
    function createCoordinateSystem( bg:Group, doPlanes:Boolean, grid:Number ):Void {
    var xAxis:Object3D = new Line3D( new Vector(-150,0,0), new Vector(150,0,0) );
    var yAxis:Object3D = new Line3D( new Vector(0,-150,0), new Vector(0,150,0) );
    var zAxis:Object3D = new Line3D( new Vector(0,0,-150), new Vector(0,0,150) );

    xAxis.setSkin( new SimpleLineSkin( 1, 0xff0000, 60 ) ); // rosso
    yAxis.setSkin( new SimpleLineSkin( 1, 0x00ff00, 60 ) ); // verde
    zAxis.setSkin( new SimpleLineSkin( 1, 0x0000ff, 60 ) ); // blu
    var axes:Group = new Group();
    axes.addChild(xAxis);
    axes.addChild(yAxis);
    axes.addChild(zAxis);
    bg.addChild( axes );

    if( doPlanes){
    var xyPlane:Object3D = new Plane3D(100,100,grid,'quad');
    xyPlane.setSkin( new MixedSkin(0x00FF00, 10, 0, 15, 1));

    var yzPlane:Object3D = new Plane3D(100,100,grid,'quad');
    yzPlane.setSkin( new MixedSkin(0x0000FF, 10, 0, 15, 1));

    var zxPlane:Object3D = new Plane3D(100,100,grid,'quad');
    zxPlane.setSkin( new MixedSkin(0xFF0000, 10, 0, 15, 1));

    // Imposta la rotazione per i piani xy e zy
    // Ricordiamo che il piano xz non richiede trasformazioni
    var tg1:TransformGroup = new TransformGroup();
    var rot1:Transform3D = new Transform3D();
    rot1.rot(-90,0,0);
    tg1.setTransform( rot1 );
    // Aggiungiamo il TransfromGroup al gruppo principale
    tg1.addChild( xyPlane );

    var tg2:TransformGroup = new TransformGroup();
    var rot2:Transform3D = new Transform3D();
    rot2.rot(0,0,-90);
    tg2.setTransform( rot2 );
    // Aggiungiamo il TransfromGroup al gruppo principale
    tg2.addChild( yzPlane );
    // Aggiungiamo i gruppi di piani trasformati al gruppo principale
    bg.addChild( tg1 );
    bg.addChild( tg2 );
    bg.addChild( zxPlane );
    //
    }
    }

    init();
    Immagini allegate Immagini allegate

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.