Closed Thread Icon

Preserved Topic: Can someone help me Create a 3D/2D movement Function? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=18252" title="Pages that link to Preserved Topic: Can someone help me Create a 3D/2D movement Function? (Page 1 of 1)" rel="nofollow" >Preserved Topic: Can someone help me Create a 3D/2D movement Function? <span class="small">(Page 1 of 1)</span>\

 
John H
Obsessive-Compulsive (I) Inmate

From: Preston, Lancashire, England
Insane since: May 2001

posted posted 01-27-2002 03:35

I've had no problems moving layers in a circular motion around the Z axis, it's a very simple equation and obviously X and Y isn't a problem because I can just ignore trigonometry entirely and just use .left and .top but what I want to do is make a function that accepts X,Y and Z co-ordinates and a field of view angle then converts the 4 variables into simple X and Y values I can use to move a layer around the screen. I know there's other things to think of like re ordering the z-index stacking of the layers according to the distance from 0 on the Z axis but generally speaking I've been totally stumped with this. If anyone knows how it's done their help would be REALLY appretiated.

DocOzone
Maniac (V) Lord Mad Scientist
Sovereign of all the lands Ozone and just beyond that little green line over there...

From: Stockholm, Sweden
Insane since: Mar 1994

posted posted 01-27-2002 12:21

I know Slime has done a brilliant example of this here -> http://www.slimeland.com/starcube/ <- I've never spent any time de-constructing it, (I try not to ever do that unless I'm *really* stumped! :-) but it would be worth looking into, methinks. I believe Slime is replacing the images with bigger or smaller versions depending on the z-index instead of transforming one existing image, but can't guarantee.

<edit> Ooh! I just peeked in at that script, it's a short one! Somehow I expected more baroque code would have been required. Cool beans. </edit>

Your pal, -doc-



[This message has been edited by DocOzone (edited 01-27-2002).]

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 01-27-2002 19:24

The explanation/proof is a bit more complicated and interesting, but what it all comes down to is this:

X2d = X3d/Z3d * PixelsPerThreeDeeUnit + XCenterOfScreen;
Y2d = Y3d/Z3d * PixelsPerThreeDeeUnit + YCenterOfScreen;
Size2d = Size3d/Z3d * PixelsPerThreeDeeUnit;

only display the object if its Z coordinate is > 0. If you want to rotate the camera, you may find it easier to instead rotate the *objects* *around* the camera.

On that page, btw, I don't actually change the size of the stars, I just have a 3x3 gif image that I replace, there are four images I think, from bright to dark. Changing size with JavaScript is difficult.

[edit: btw, your screen name is driving crazy, my name is John H too =) ]

[This message has been edited by Slime (edited 01-27-2002).]

lallous
Paranoid (IV) Inmate

From: Lebanon
Insane since: May 2001

posted posted 01-27-2002 20:38

slime, I just checked your page and I really like it!! good work!

John H
Obsessive-Compulsive (I) Inmate

From: Preston, Lancashire, England
Insane since: May 2001

posted posted 01-28-2002 00:41

Thanks for the advice :-)

I've been picking through the starcube sourcecode for a while this afternoon, It's a bit simpler (well less lines of code anyway) than i thought it would be but i still think it might take me an hour or 2 to make a function to do what I was looking at doing. It's amazing that people are making DHTML pages like starcube, it reminds me of all those demos I used to have on my Atari in late 80s early 90's. to get an idea of what I'm refering to check out this site...
http://wwwbrauer.in.tum.de/~brandtf/ataridemos.html

it's always baffled me how they do a lot of that stuff. I reckon a lot of it could be done in DHTML these days which is one of the reasons why I've been learning DHTML for a couple of years, I've also been learning it because I want to get out of the DTP/Graphic design industry for good before I hit my late 20s but that's another story.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 01-28-2002 18:36

This would probably take tons of reverse engineering but it absolutely amazing



:[ Computers let you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila. ]:

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 01-29-2002 10:04

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 01-30-2002 07:42

InI, I think most browsers either buffer the entire screen before drawing, or, if not, they're not well written enough to use a containing Div as a buffer.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 01-30-2002 08:38

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 01-30-2002 15:48

Oh, I believe that a double buffer is faster. I was merely suspicious that browser makers were smart enough to let a Div behave as one. =) I'll take your word for it though.

RoyW
Bipolar (III) Inmate

From:
Insane since: Aug 2001

posted posted 01-31-2002 07:06

Hey bitdamaged, I have seen that site. That is where I got the idea for this demo.
3D demo IE,NS4 (not NS6)
(there are lots of other demos on that site and even though most are IE only they are unique!!)

JavaScript Gadgets'n'Gizmos

[This message has been edited by RoyW (edited 01-31-2002).]

« BackwardsOnwards »

Show Forum Drop Down Menu