Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / How to create scene for 3d planes, to use them as 2d sprites? Help!

Author
Message
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 30th Mar 2011 18:57
How to create scene for 3d planes, to use them as 2d sprites?
Meaning how to create a camera and how to easier set planes coordinates.
Please Help!
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 31st Mar 2011 02:03
The best way to do it, is something like this:

dbPositionCamera(0, 0, 70);
dbPointCamera(0, 0, 0);

Then with your planes you will do something like this:
dbMakeObjectPlane(1, 20, 20);
dbSetObjectToCameraOrientation(1);

Thats a starting point, then to move the object you can use db object position, but don't use the Z coordinate. Heres a sample program:


Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 1st Apr 2011 12:07
Thank you!

But how to convert 3D coordinates into simple 2D screen coordinates, or vice versa???
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 6th Apr 2011 18:48
s.o.s.
WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 6th Apr 2011 20:37
Are you wanting to fake a 3d scene? Doing it that way you could use isometric graphics. To get a better understanding of using iso tiles just google it on normal web search or on images.

Otherwise, depending whether you're having the camera above a scene or looking at it from the side. The center of the 'world' system is 0,0,0 (x,y,z). The z axis goes in and out of your screen so you could think of the x and y coords as not far from being the same as the screens.

That is if you use:

The x and y coords are now centered on the screen.

Warning! May contain Nuts!
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 7th Apr 2011 16:30
I just figured this out yesterday, might work for what you are doing, if I understand you correctly.



Create a plane which will act as your backdrop, perhaps make it (1024, 768) in size, or whatever your screen resolution?

Place the camera back some distance and point at centre of plane.

Use the code above to set your camera, 'distance' is the camera distance from plane, 'viewWidth' is the plane width etc.

You can then work as in 2D but in 3D, I think thats what you were asking?

Login to post a reply

Server time is: 2024-06-15 18:02:22
Your offset time is: 2024-06-15 18:02:22