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 / 3D Mesh Orientation - Another Silly Question

Author
Message
iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 4th Apr 2011 04:01
This might border on the "dumb questions" category...

Short question, this is about cameras, rotation angles, scales, and orientations:

- I want the coordinate system to be an overhead view where +x is my right hand when I'm facing the screen, +y is above the TV/Monitor, and +z is flying at my face. What should be the coordinates of the camera? What should be the SetCameraRotationX/Y/Z angles? I sort of had it before, but it wasn't quite satisfactory because I think I rotated Y to -90 degrees and moved -Z some units, making +Z point into the screen (which is undesirable because I should be looking at the ground).

- Is there a default orientation of a 3D object? As in, every object's FRONT should be pointing towards +Z infinity and top should be pointing towards +Y infinity. I mean, if I can set everything to have a default forward facing orientation, then I can do something like a loop command that will face everything forward or face East or something whenever I hit a key. What if it's facing the wrong way by default, is there a way to set its default rotation in dgdk without editing the .x file?

- About DGDK Sizes of stuff. I understand that positions and sizes are floats. What's a good rule of thumb for how big an object should be size wise? dbObjectSizeX/Y/Z should be scaled to what size, exactly? I mean, I can zoom right into tiny object of 5 dgdk units wide or zoom away from big objects that are 5000 units. So, what should they be?



Sorry for all the questions. You guys have taught me a LOT, though. My game engine design portion is almost complete ( Completely OO Engine that I could reuse for any and all future games, like a game development skeleton on DGDK and Fulcrum ). UML diagram is almost complete. Once it's done, I'll be able to start coding - that's where it'll get really exciting and I'll need even more help to debug my inexperienced mistakes
Mireben
15
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 5th Apr 2011 22:25 Edited at: 5th Apr 2011 22:46
Question 1: your description is a bit confusing and it's a pity that on the forum you can't show with your hands how you imagine it.

By default: +X points horizontally right, +Y is vertically upwards (if that's what you meant by "above the monitor" then it's correct) and +Z points into the monitor, away from you. If by "+Z is flying at my face" you meant that +Z should be pointing towards you (while the other two axes remain unchanged), then it's not possible, because you can't rotate a left-handed coordinate system into right-handed.

If you want a top-down view for the camera, so that it's looking at the ground: with the above rules, the "ground" is the X-Z plane and the camera would be looking vertically down along the Y axis. That means the camera should be rotated 90 degrees around the X axis to face down. This should do the trick: dbRotateCamera(90, 0, 0); Then position the camera at a positive Y coordinate, high enough to see the area of ground you want to see. With the Y coordinate you control camera height, with the X-Z coordinates you control its horizontal position parallel with the ground.

Instead of dbRotateCamera, you can also position the camera at a high Y point, e.g. dbPositionCamera(0, 200, 0); and then use dbPointCamera(0,0,0). It will have the same rotation effect: make the camera look down.

Question 2: With dbFixObjectPivot you can set the current rotation of an object as the default. That will be its zero point for all subsequent rotation commands.

Question 3: the objects should have some reasonable size. There are no general guidelines, but they should be scaled so that they fit each other, they fit the game environment (e.g. the size of your terrain), and also take into account that you may need to calculate with those sizes, so you don't want an overflow or underflow in your variables. Otherwise, make the sizes so that it's easy for you to imagine and handle. For example, if a man is 1.8 m (or six feet, whichever you prefer) and a building or tree is 10 meters tall, it is easier than some arbitrary size which does not correspond to anything in the real world.

If you buy models from the store or download them from somewhere else, you can check what sizes they are. There are dbObjectSizeX (and Y and Z) commands that tell you the sizes in three directions. Then you can decide whether to leave them as they are and calculate with that size or you want to scale them.

EDIT: Also take into account that scaling takes time, if you need to scale every object after loading them, then the loading time of the game will be longer.
iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 6th Apr 2011 21:00
Thank you, you've answered so many of my questions. Thanks for taking the time.

I see now that I forgot all about left and right hand coordinate systems. I get it now! By my definition of overhead, I guess I want to use X and Y axis as the game plane, so I would actually be moving the camera in the -Z direction (say, -100 z) and then dbPointCamera at (0,0,0).

dbFixObjectPivot was EXACTLY what I was looking for, but I guess I missed it while checking out the documentation. Thanks!

Unfortunately, I don't think that different people making different models will make them the same size, so scaling is inevitable. Then again, if it were really a higher end production, one would be generating their own assets, making them specific sizes, specific poly numbers... I'm totally horrible in art, unfortunately. Only 3D software I've ever used was Milkshape, and I failed to make a human even with tutorial, lol.

Thanks again for all your help!

Login to post a reply

Server time is: 2024-06-15 23:28:14
Your offset time is: 2024-06-15 23:28:14