PDA

View Full Version : 3d


vulcanpimp
09-26-2003, 09:33 AM
this is a comparatively easy challenge. anything in a 3d world. As many lines as you wish.

and heres mine. You can download here as a text file

http://www.geocities.com/hairybobby2000/fx3ids.html

or cut and paste from the browser here

_root.createEmptyMovieClip("grad", 1);
with (_root.grad) {
_x = 200;
_y = 100;
onEnterFrame = function () {
if (yyy == undefined) {
yyy = 1;
xxx = 1;
}
yyy += ((_ymouse-_y)/40);
xxx += ((_xmouse-_x)/40);
Clear();
lineStyle(1, 0xefcefc, 100);
p1x = [-141, -111, -141, -14, 33, 48, 32, -15, 176, 123, 113, 124, 168, 176, 170];
p1y = [-7, -7, 32, -7, -7, 15, 32, 31, -8, -8, 8, 14, 13, 21, 31];
p2x = [66, 147, -43, 43, 50, 50, 107, 52, 37, 109, 116, 145, 175, 176, 164];
p2y = [204, 160, 33, 104, -3, 27, 68, 96, 61, -5, 15, 29, 13, 30, 101];
p3x = [-81, -111, -81, 33, 48, 32, -15, -14, 123, 113, 124, 168, 176, 170, 116];
p3y = [-7, 32, 31, -7, 15, 32, 31, -6, -8, 8, 14, 13, 21, 31, 32];
for (i=0; i<p1x.length; i++) {
for (ii=1; ii<4; ii++) {
if (ii == 1) {
xx = 0;
yy = p1x[i];
zz = p1y[i];
}
if (ii == 2) {
xx = 0;
yy = p2x[i];
zz = p2y[i];
}
if (ii == 3) {
xx = 0;
yy = p3x[i];
zz = p3y[i];
}
tempz = (zz*Math.cos(yyy*0.0175))-xx*(Math.sin(yyy*0.0175));
newx = (yy*Math.sin(xxx*0.0175))+tempz*(Math.cos(xxx*0.01 75));
newy = (zz*Math.sin(yyy*0.0175))+xx*(Math.cos(yyy*0.0175) );
newz = (yy*Math.cos(xxx*0.0175))-tempz*(Math.sin(xxx*0.0175));
newx = 133+newx+(newz/10);
newy = 133+newy+(newz/10);
if (ii == 1) {
p1x[i] = newx;
p1y[i] = newy;
}
if (ii == 2) {
p2x[i] = newx;
p2y[i] = newy;
}
if (ii == 3) {
p3x[i] = newx;
p3y[i] = newy;
}
}
}
MoveTo(p1x[0], p1y[0]);
LineTo(p3x[0], p3y[0]);
MoveTo(p1x[1], p1y[1]);
LineTo(p3x[1], p3y[1]);
MoveTo(p1x[2], p1y[2]);
LineTo(p3x[2], p3y[2]);
MoveTo(p1x[3], p1y[3]);
LineTo(p3x[3], p3y[3]);
curveTo(p2x[4], p2y[4], p3x[4], p3y[4]);
curveTo(p2x[5], p2y[5], p3x[5], p3y[5]);
LineTo(p3x[6], p3y[6]);
LineTo(p3x[7], p3y[7]);
MoveTo(p1x[8], p1y[8]);
LineTo(p3x[8], p3y[8]);
curveTo(p2x[9], p2y[9], p3x[9], p3y[9]);
curveTo(p2x[10], p2y[10], p3x[10], p3y[10]);
LineTo(p3x[11], p3y[11]);
curveTo(p2x[12], p2y[12], p3x[12], p3y[12]);
curveTo(p2x[13], p2y[13], p3x[13], p3y[13]);
LineTo(p3x[14], p3y[14]);
duplicateMovieClip(_root[this], "g2", 11);
};
}

senocular
09-29-2003, 09:22 PM
sooo easy, everyone wants not to compete :D

vulcanpimp
10-01-2003, 10:28 AM
well I kinda thought 3d was easy. I know the 3d I use is pretty simple it amounts to just 6 lines

tempz = (zz*Math.cos(yyy*0.0175))-xx*(Math.sin(yyy*0.0175));
newx = (yy*Math.sin(xxx*0.0175))+tempz*(Math.cos(xxx*0.01 75));
newy = (zz*Math.sin(yyy*0.0175))+xx*(Math.cos(yyy*0.0175) );
newz = (yy*Math.cos(xxx*0.0175))-tempz*(Math.sin(xxx*0.0175));
newx = 133+newx+(newz/10);
newy = 133+newy+(newz/10);

But I know a lot of 3d demos in flash have about 10 different functions in which can basically just slow things down. But to me its just a matter of xyz positions and an xyz rotation.

I know theres this example on my site which shows 3d in its basic form

http://www.geocities.com/hairybobby2000/fx3d1.html

that just moves a point in a 3d world. Then to build a vector shape you just do it in 3d then revolve it around in a 3d world.

vulcanpimp
10-01-2003, 10:34 AM
maybe I could suggest a few options for a challenge and if someone shows an interest in one I could go with that instead.

I know I was kinda thinking about one of several different topics for a challenge

1. 3d (as above)
2. paint splatter - some genuine kind of motion for paint splattering. a bit like a jackson pollock painting
3. a boat moving up and down in a gentle bobbing motion

dzy2566
10-01-2003, 11:05 AM
There's nothing easy about 3D. The paint splatter challenge sounds intersting. I'd vote for that. Not sure I can do it, but I'll give it a shot sometime next week.

vulcanpimp
10-01-2003, 11:09 AM
Ok - shall I post up a new challenge or just continue here ? I haven't got anything myself yet - but its a good idea

senocular
10-01-2003, 02:28 PM
my 3d tutorial makes it fairly easy to understand (no matrix confusion included). Its lengthy though, and there arent too much in the ways of optimization - the examples listed so far all use 3 axis rotations in the script though only 2 are actually implemented.

... in the forums I have some examples altering the code so it wont calculate more than it needs to... but nevertheless, it works as it is there:

http://www.kirupa.com/developer/actionscript/3d_index.htm

just go from the top on down.


But the paint splatter thing sounds fun too :)

dzy2566
10-01-2003, 02:46 PM
@ senocular - Thanks, I'll check it out. I think on some level it comes down to understanding math, not AS. EDIT: I've never visited your site before. That's one heck of a resource you've got there. I think I'll be spending a lot of time browsing it. Thanks!!!

@ vulcanpimp - I suggest starting a new challenge. Who know's, maybe this will catch on. And you want to attract people to the new one who have already decided that this one wasn't for them. Fire away!

Jesse
10-02-2003, 12:08 AM
Just a quick reminder: when writing code blocks, please use the actionscript tags. You do this by in Selecting your code in the following tags:
[as ]somecode[ /as] (without the spaces)

vulcanpimp
10-02-2003, 09:34 AM
yeah great resource senocular

I know a lot of people get really put off by 3d cos many make it far too complicated than what it is. Though I still haven't quite got my head around the 3d translate.

I know my example is not that good - but I was hoping to get some interest going on the topic of 3d. I've put a page up on my site.

http://www.geocities.com/hairybobby2000/fx3ids.html

the first example is the one I started off the thread with and the second is a little utility I wrote which actually created the vector shape. I was wondering if anyone else had such an idea. Because I've seen some similar ideas around but found them difficult to work. The utility lets you draw 3d vector shapes and then creates the code for them which it outputs to the message window in a trace command.


I know the utility is a bit ropey but it works. I'll probably rework it later.

senocular
10-02-2003, 10:17 AM
Ive made tools like that for drawing things and outputting code (I actually have a flash panel floating around that does that just to serve as an example for a flash panel) though usually I just draw the shape in Flash then duplicate movieclips at its corner points (physically in the flash IDE) and have a simple 2-3 line loop go through and snag the coordinates of those clips and trace them in a formatted manner when the movie is tested. Just a little easier to deal with I think... at least for flat or extruded shapes. More complex 3d shapes I map out on paper.

junahu
10-22-2003, 08:32 AM
here's something I made

thingy (http://www.geocities.com/janaspararto/hoops.html)

I'm not going to explain it because this forum keeps cutting me off when I write long replies and it's sooo annoying to be asked to log in while some html hoopu joopu erases my post.

Guess I should explain it though. This was mostly an accident whilst trying to create an effect for a webpage I intend to eventually (year 3000 eventually) create.

vulcanpimp
10-22-2003, 01:32 PM
oh its only about three weeks snce i posted it up and I've got a challenger. Jipeee!!!

v nice indeed.
your ...um ....thingy is v good

senocular
10-22-2003, 01:37 PM
I did this for a k-battle, but I figured I could post it here too:
http://userpages.umbc.edu/~tmccau1/flash/kirupa/fishyfollow.html