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.

3 Dimensional Chat / 3D object positioning and camera angles

Author
Message
Linehan
15
Years of Service
User Offline
Joined: 13th Oct 2009
Location: Salem, MA
Posted: 13th Oct 2009 18:41
I have been using DBPro for a while, but not really tackled anything too involved as yet. I have mostly been creating silly and fun little 2D games and even a couple of utilities like an automated rapidshare download tool. However, I have been trying to learn more about 3D coding because I want to create an educational program where my daughter and her friends can fly in a spaceship all around the solar system and visit each planet to learn various details about each world.

I am having trouble with placing and controlling the spaceship though. I have figured out just about everything I need to in order to write this program, but for some reason I can not figure out how to place the 3D ship on screen and position a camera that would sit behind and a little above the ship and keep this view throughout the flight(s).

My problem is that when I create the 3D object I never know what is considered the front, etc. So I can not get the object on the screen and the camera positioned where I need it to be. I have tried placing it at a hundred different angles and tried rotating it every which way but loose.

When you create a 3D object how do you know which direction the object will be facing by default??
BowserYo
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location:
Posted: 13th Oct 2009 20:35 Edited at: 13th Oct 2009 20:36
Linehan, you are in the wrong forum. This should be under the "Newcomers to DBPro Corner" forum.

To answer your question, you need to (in your main loop) get your ships position(s) and angle(s). If you don't know how you can do it like this:



Then, to place your camera behind the ship:



The "move camera" is what moves it behind the object, the value may need to be changed depending on the scale of your objects.

So:

You position your camera at objects position
You rotate your camera to the objects rotation
You move the camera backwards 10 units.

Understand?

ßõw§€r¥¤

Login to post a reply

Server time is: 2024-11-24 21:40:38
Your offset time is: 2024-11-24 21:40:38