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 / Dark DGK C++: Camera Angles Min/Max Behavoir

Author
Message
Timidon
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 4th Oct 2010 03:46
Hi folks been a while since I have posted. Here is what I have been working on. A 4x game, classic conquer the galaxy. Ran into a bit of snag with the camera. Just some odd behavior I have ran across. Just wondering if anybody ran into something similar and what they may have done to correct it. Spent two hours so far making some adjustments, but the having a hard time taming my camera. Here is a few screen shots to help you understand what I am aiming for.

There are many answers but just one question" ~ Jerilith the Mad

Attachments

Login to view attachments
Timidon
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 4th Oct 2010 03:50
2nd Shot this is a bit zoomed closer. I got a few moons orbiting the center gas giant.

The code i use for the orbit is as follows:



This created me a working orbit path for the moons to follow. The planets are place the same way.

Even got the mouse to zoom in

There are many answers but just one question" ~ Jerilith the Mad

Attachments

Login to view attachments
Timidon
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 4th Oct 2010 03:57
So so far so good, until I try to set the camera "Level" on the map viewing the planet from the side. The camera is suppose to be viewing the planet and orbiting around it. The camera view jumps to a vertical view. Orbits about 1/2 then dose a dramatic flip to the other side. I spent a a while to to rotate the camera view. I am figuring I am hitting some sort of camera axis behavior. Just thought I would put this out to see what other people have come up with.

The close up view of the planet is primarily for a small side window, where the player see's a small rotating view of the world. I am thinking about building a sprite, plastering the image then rotate the sprite to the proper angle, it's just another step.

There are many answers but just one question" ~ Jerilith the Mad

Attachments

Login to view attachments
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 4th Oct 2010 04:04
That wierd stuff usually occurs when you cross the Y-axis, right? That's a big problem with free-space movement. I hope someone gives you an easy solution.... I want it as well....

The fastest code is the code never written.
Timidon
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 4th Oct 2010 04:14
That may be it. It's not the first time I have encountered the strange flipping issue, but I scrapped the project before I could build a work around.

There are many answers but just one question" ~ Jerilith the Mad
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 4th Oct 2010 04:17
How do you handle your space ship's angles? Do you use dbRotateObject or dbPitchObjectUp/dbTurnObjectRight/dbRollObjectRight?

The fastest code is the code never written.
Timidon
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 4th Oct 2010 04:30 Edited at: 4th Oct 2010 04:33
When I was running my space fighter sim, I was using EzRotate, which worked well controlling the way the ship worked, but I got a memory leak somewhere in my program the spilled into the EzRotate varibles, caused the ship to vanish. Here's the old link to some prototype work:

For this game, things where going to a bit more basic in controlling ships and fleets. First off I am going to be using a Top down view, it will be a 2d view using 3d game space. Since I am not a great 3d modeler and to save time. I will be using the the "dbMakeObjectPlain" should be able to create a texture for it, kinda like a sprite, so basic turns left and right "should" work with easy. Though that is still a bit a way, still writing down ship concepts, A Good concept I ran across was "Gratuitous Space Battles". It's a variation of the tower defense game, fun to watch.

Well back to working on a work around. I almost got the camera to go to a variation of side ways.

There are many answers but just one question" ~ Jerilith the Mad
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 4th Oct 2010 04:34
If you are going to have a top-down view, then rotation is not a problem. If you want to try a first-person approach, I think the pitch/turn/roll method might work for you.... Good luck.

The fastest code is the code never written.
Timidon
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 4th Oct 2010 04:41
Top down solves allot of my programing head aches. I might just work with that I think I can set myself something that will work. It's just that old school backyard feel to games. I plan on having some fun with this project, then again I have been working on it for years. Building, crashing and finally scrapping a project. Each time it gets a bit more stable.

There are many answers but just one question" ~ Jerilith the Mad
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 4th Oct 2010 04:44
Retro is cool.... I think the best space game (of it's time) ever made was the original "Star Flight". Well, I wish you luck on finishing it.

The fastest code is the code never written.
Timidon
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 4th Oct 2010 08:24 Edited at: 4th Oct 2010 08:25
Alright, go it fixed. What I ended up doing was watching the behavior of the models while manual changing the rotation via keyboard. When I found a post on the the function "dbSetCameraToFollow" which does a allows the camera to rotate around a set point in 3dspace. While running this function In noticed it was nice and smooth and went around the way I wanted it to. So instead of changing the camera to orbit the way I wanted it to. I reorientated the map and objects. And now I got what I want. Yeah only 4-5 hours of poking. But here are results!

There are many answers but just one question" ~ Jerilith the Mad

Attachments

Login to view attachments
Timidon
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 4th Oct 2010 08:27 Edited at: 4th Oct 2010 08:44
The Gas Giant with proper stance, at the right plane.

and the final code for this bit


There are many answers but just one question" ~ Jerilith the Mad

Attachments

Login to view attachments
Timidon
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 4th Oct 2010 08:30
Last Screen Shot of a system with a Black Hole. What you can't really see the little bits of rock flowing into the center. I plan on getting some more models for gas that can swirl into the center for a better effect.

Thanks for looking at the post. Any questions or suggestions please post.

Later Timidon.

There are many answers but just one question" ~ Jerilith the Mad

Attachments

Login to view attachments
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 4th Oct 2010 10:26
Out of interest, I kinda want to try to solve the original problem... But I'm not exactly sure what your code is doing...

I'm guessing...
POSITION_SetPositionXYZ(); positions the camera, and you then use the point camera command to turn the camera towards the planet?
Then, when your x angle gets to be 90 or 270 degrees, the camera's roll shifts by 180 degrees?

If so, point camera is the culprit, and I know of a not too hard solution involving rotation matrices.

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 4th Oct 2010 16:38
The original problem of wierd camera rolling should only occur at the Y-axis. If the orbit of the "ship" is near the XZ-plane, there should be no problem.

The fastest code is the code never written.
Timidon
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 4th Oct 2010 17:27 Edited at: 4th Oct 2010 17:37
That's what I am figuring. When I set up my initial map, What I thought was looking at xyz so I set up the camera and objects with that in mind. There was a kink that should of told me I was looking at the world a bit off. I had to pitch my planets so that the skins would be horizontal flat (top down view would be the top).



So I then continued working, I set up the camera to get a close side view. When I did this, whipped the camera to new location, the view went all vertical and I got the "Y" axis weird flipping.



After experimenting with different camera views and code I finally decided to post to see if other people had the same problem. Then went back to coding another 2 hours went by of experimenting with the camera and I ran across a post using another command. The "dbSetCameraToFollow" witch can orbit around a object at specific distance and height. This should be that I built my 3d map space sideways in respect to the default way DGK handles the camera. So I changed the math for the orbit calculations to run with the X and Z and left the Y as the height. The end result having to move the map around gave me a nicer looking solar system.



and the Side shot of the Planet, which later will be put into it's own little window and image.



So I figure what went wrong is that my 3dspace map was being viewed from the side, correcting that gave me the view I was looking for. Besides I get re post all my pictures..

Neuro Fuzzy
Quote: "Out of interest, I kinda want to try to solve the original problem... But I'm not exactly sure what your code is doing...

I'm guessing...
POSITION_SetPositionXYZ(); positions the camera, and you then use the point camera command to turn the camera towards the planet?
Then, when your x angle gets to be 90 or 270 degrees, the camera's roll shifts by 180 degrees?

If so, point camera is the culprit, and I know of a not too hard solution involving rotation matrices." "


I think you are right, I could not figure that out, so I changed the world to match the camera. Still early enough to do that in this stage of development.

There are many answers but just one question" ~ Jerilith the Mad

Login to post a reply

Server time is: 2024-06-30 11:52:21
Your offset time is: 2024-06-30 11:52:21