Ship simulation

Started by
6 comments, last by shellshock 20 years, 7 months ago
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
Advertisement
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

http://www.math.montana.edu/frankw/ccp/multiworld/multipleIVP/spherical/body.htm

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]
I don''t know if this pretains as I only read a little of the post. [3rd person camera tut]
Quote:Michael TanczosCut that shit out. You shouldn't be spying on other people.. especially your parents. If your dad wanted to look at horses having sex with transexual eskimo midgets, that's his business and not yours.
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.
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!"
"There are people who live in the reality. We recreate it!"
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...
but

iz gone!?!? *CRY*

GreetZ
Woolf
Search for a post started by me that has a link to the tutorial.
"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
if(PortAndCompile_FromWinToLin_Time != compile_time) MyGame.AddTag("It Suxx");

This topic is closed to new replies.

Advertisement