Closed Thread Icon

Preserved Topic: Help! (simple 3D dhtml shufflepuck) (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=18337" title="Pages that link to Preserved Topic: Help! (simple 3D dhtml shufflepuck) (Page 1 of 1)" rel="nofollow" >Preserved Topic: Help! (simple 3D dhtml shufflepuck) <span class="small">(Page 1 of 1)</span>\

 
Hew
Neurotic (0) Inmate
Newly admitted
posted posted 03-24-2002 21:43

I was just wondering if anyone could help me, Ive been trying for hours , with basically one line in my script:

_Here_

It isnt yet finished, so far, the paddle moves nicely, and the balls X+Y coords move it in 2d as in it bounces around in a box, but not in the shape I want.

I know someone , Slime I think, posted this a while back, which seems to make sense:

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

Size2d = Size3d/Z3d * PixelsPerThreeDeeUnit; <- I've done this bit a different way, it works.

I couldnt get this to work properly, for one Im not too sure what PixelsPerThreeDeeUnit should be, and this pong game doesnt really have a Zaxis, because, its relative to the Y Axis, so it really only has two axises.

The X axis (Xd, in my script), of the ball is either a positive or negative distance from the center of the board which makes it even easier.

Anyway .. if Im making sense, (I doubt it), could someone fix that one line for me ? its marked in the source you wont miss it.

things:
Xd is always a number between -126 and 126
Yd is always a number between 0 and 200 , which is the Z axis aswell.




[This message has been edited by Hew (edited 03-24-2002).]

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 03-24-2002 22:46

Ah, OK. For starters, realize that you're calling Y what I called Z.

Also realize that you're looking at the table from above it. So the balls' Y coordinate (the vertical coordinate, in any case) is less than zero.

So you should be calculating something like this:

x2d = x3d(which is some number between -126 and 126)/z3d(which is somewhere between 0 and 200, but try adding a constant like 100 to this number).
y2d = -100(or so)/z3d

Now, you may have problems getting things to fit the image exactly, because I'm not sure you made the image reflect the coordinate system you're using. You may have to remake the image after establishing how your coordinates will work.

Hew
Neurotic (0) Inmate
Newly admitted
posted posted 03-25-2002 18:24

Hey thanks, okay I'll try that, but heres a quick diagram :


I have A , as in the ball bounces in a square, simple.

But I want to make it B, calling it Y or Z shouldnt matter, it still only needs two axis.
I plan on fitting it perfect with trial and error or maybe if I fully understood what I was up to , I could work it out from the angles of the sides.

RoyW
Bipolar (III) Inmate

From:
Insane since: Aug 2001

posted posted 03-26-2002 07:31

FASCINATING!! project,
can't explain it now -too much beer -too late -too lazy whatever(pickone)
A cool idea...
Here is what I came up with hope the code explains it.

First - need to make sure the ball covers the table http://www.javascript-fx.com/post/ozone/three_d/index.html

Second - bounce the ball around http://www.javascript-fx.com/post/ozone/three_d/index2.html

Third - why not add a shadow (a duplicate object with a "y" -6 position) http://www.javascript-fx.com/post/ozone/three_d/index3.html

Anyone remeber "Discs of Tron?"

Hew
Neurotic (0) Inmate
Newly admitted
posted posted 03-26-2002 14:58

Oh my god , thanks !! Im gonna read this code, until I know it backwards, I was thinking about adding a shadow, for the slider shhuffle thing too, if I did , they 'd be just part of the image, seeing as though it never changes, it means less processing power, as in it doesnt have two divs instead of one.

Am I allowed just take this code or what ?

I guess I'll just nick the bits I need.

again .. thanks a lot !

Edit: I just noticed it slows down, when its far away, I knew my code, wouldnt be able for this .. sweet.



[This message has been edited by Hew (edited 03-26-2002).]

« BackwardsOnwards »

Show Forum Drop Down Menu