Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Ship simulation

This topic is 5560 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im trying to create something like the Freelancer game, where the camera is located behind the ship you control. It allows you to move and rotate in any direction. I was able to fix the free look type of view for the camera but im having trouble in thinking of a way to generate the object in front of the camera. Currently I''ve used the camera target (gluLookat) to move the ship in front of it, but i can''t think of a way to rotate the ship so that it displays the correct orientation (which is where the camera looks directly at the back of the ship, top of the ship is also the top of the camera) any ideas on this one? I really need help

Share this post

Link to post
Share on other sites
I am trying to do the same thing, but for some reason, my model no longer displays.

I know how to implement the follow cam, but the model just stopped displaying one day. (I'm sure it was something I did, I just can't remember) Anyway it's pretty simple, just get the ships position, use spherical coords to find the point you want to point the camera at relative to the ship. Then you can either rotate the camera around the ship or the point. I would recommend the ship, because it will stay equidistant.
Then use spherical coords again to find the camera poisition relative to the centerpoint (the ship in this case). Then just set the camera to that point and set the viewpoint to the point above or whereever on the ship.

I would look into using quaternions (specifically SLERP, but using quaternions with SLERP is easiest, in my opinion) for smoothing out the rotation, or else it will be really stiff, so to speak.

For a great tutorial on spherical coords, incase you don't know anything about them, is


Sorry, dont' know how to do links!

The graphics make it easy to understand. If you have any more questions, just post a reply, and I will try to remember to check here.

[edited by - crossbow on August 18, 2003 6:28:19 PM]

Share this post

Link to post
Share on other sites
It wouldn''t relaly work for the rotations of a spaceship, it''s more for like something for a 3rd person shooter kind of camera.

Share this post

Link to post
Share on other sites
for beginner.... it would be easy. You set the glTranslate() to the center of the ship. so you use glRotate() on the x axis. so, u will rotate around the glTranslate point.

I''m just a test pilot.lol

"There are people who live in the reality. We recreate it!"

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
ERm ok

but what if i want to place (and rotate) other clients, if i know direction, position, upvector and strafevector?
i also use glulookat for moving, upvector+=strafevec for rolling and that

in 3 forums they said i should calculate the angles, but it gives even more problems

what i did:
player.look //the camera now does gluLookAt(pos, pos+dir, upvec)
translate(client.pos) //clear...
client.looknull //same as look, but with v(0,0,0) as position and only DIR as viewpos

what now happens: if the client rolls, the rotation start to get weird and weird... it just does not work as it should

Could you help?

i wanted to get into that quaternions, and wanted to look at GAMETUTORIALS lesson 7 for it...

iz gone!?!? *CRY*


Share this post

Link to post
Share on other sites
"Search for a post started by me that has a link to the tutorial."

couldn''t find one, and the link of the "NeHe''s Game Tutorials" thread is down

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!