Posted by: Haron Dec 26 2006, 12:03 AM
hi.
I'm getting crazy. It seems very simple, but I don't know how to achieve...
for example, I have eight points that defines an irregular box with its surfaces, and I would like to draw this box...
I'm
following the tutorial http://www.petitpub.com/labs/media/flash/sandy/
(very good), but the author uses only primitives objects, and I don't
know how to create my owners objects.
it is a very simple question, but I have no idea.
(sorry for my spaninglish)
Posted by: kiroukou Dec 26 2006, 09:50 AM
Hola Haron,
Well a tutorial is missing on this part. The best solution nowaday is to look at the promitive package, and learn the code.
Basically you must define your points, your faces, and evetually your texture coordinates.
But a tutorial will come on that art, because I know this is something important.
Cheers,
Thomas
Posted by: Haron Dec 27 2006, 02:33 PM
Hi, kirokou.
thanks for your help.
finally,
I achieve to draw a box and a plane, creating two objects like the
primitives. a little complicated, perhaps becouse I don't know 3d
concepts.
another thing I saw is the direction of the points. for example if you define a plane like this in the 'generate' method:
CODE
var p0 = new Vertex(-50,0,-50);
var p1 = new Vertex(50,0,-50);
var p2 = new Vertex(50,0,50);
var p3 = new Vertex(-50,0,50);
aPoints.push (p0);
aPoints.push (p1);
aPoints.push (p2);
aPoints.push (p3);
//Face creation
var f = new QuadFace3D(this, p0, p1, p2, p3); <-- be carefull with the order of the points
addFace( f );
it doesn't show any plane. but if you change the code by:
CODE
//Face creation
var f = new QuadFace3D(this, p0, p3, p2, p1); <-- be carefull with the order of the points
it works. it seems like the perpendicular vector defined by the sense of the points is important (oh, my English!).
anywhere, I need to learn more about 3d modelation.
do you know a pretty tutorial about this??? (for dummies)
thanks and congratulations by the job!
Posted by: Haron Dec 27 2006, 03:18 PM
yeah!
CODE
var f = new QuadFace3D(this, p0, p1, p2, p3);
it doesn't appears because it is backwards from my camera.
but the next plane isn't:
CODE
//Face creation
var f = new QuadFace3D(this, p0, p3, p2, p1);
it has sense. I like it.
Posted by: sarab_sabi Mar 23 2007, 07:00 AM
hey Dude
chk if this correct. coz nothing is showing up. except the 3d axis at centre
CODE
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), 550, 550);
var cam:Camera3D = new Camera3D(700, screen);
cam.setPosition(50, 50, -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 {
var p0 = new Vertex(-50, 0, -50);
var p1 = new Vertex(50, 0, -50);
var p2 = new Vertex(50, 0, 50);
var p3 = new Vertex(-50, 0, 50);
aPoints.push(p0);
aPoints.push(p1);
aPoints.push(p2);
aPoints.push(p3);
var f:Object3D = new QuadFace3D(this, p0, p3, p2, p1);
addFace(f);
var skin:Skin = new SimpleLineSkin(1, 0xff0000, 100);
f.setSkin(skin);
var tg:TransformGroup = new TransformGroup();
tg.addChild(f);
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, 100));
yAxis.setSkin(new SimpleLineSkin(1, 0x00ff00, 100));
zAxis.setSkin(new SimpleLineSkin(1, 0x0000ff, 100));
var coords:Group = new Group();
coords.addChild(xAxis);
coords.addChild(yAxis);
coords.addChild(zAxis);
bg.addChild(coords);
bg.addChild(tg);
}
init();