does any body know how to use blitzbasic On 10/1/07, richard sabbarton <richard.sabbarton@xxxxxxxxx> wrote: > > Hi Julien, > > That seems to show that the code is working. It only serves to calculate > the exact position of the camera. You need to perform a rotation of the > camera seperately. You should not need to calculate this because you > already know the rotation of the plane. > > Also, as an additional idea, you may want to try something I implemented > during one of my tests. It gave a greate effect that would be ideal for a > flight simulator. What I did was detach the camera rotation (Z Axis/tilt > left/right) from the actual position. Then I place some code to determine > whether you were turning left or right. If you were turning left then the > camera would tilt left. The longer you spent turning the further it would > tilt. I set some max limits on tilt to stop it from rolling completely. > The best effect was when you were not turning. I put some code in to slowly > return the Z Rotation of the camera to Zero. If you quickly turn from left > to right the effect is doubled because you are returning to Zero (no longer > turning LEFT) and also turning right. > > This was a simple piece of code but gave a good feeling of inertia. > > Regards > > Richard > > > On 01/10/2007, Julien Breton <julienbreton@xxxxxxxxxx> wrote: > > > > Hi Richard, > > > > When I turrn the plane around the Y axe in global coordinates the plane > > turns on his Y axe in the same time. Now with your function the camera turns > > around Y with the plane in the plane coordinates. > > I have just a little problem because the camera looks always straight > > (the camera doesn't turn on her Y axe) but I think it's not a big problem. > > > > thanks for your help, > > > > Julien > > > > ------------------------------ > > Date: Fri, 28 Sep 2007 09:59:33 +0100 > > From: richard.sabbarton@xxxxxxxxx > > To: julienbreton@xxxxxxxxxx; gameprogrammer@xxxxxxxxxxxxx > > Subject: [gameprogrammer] Re: flight simulation camera > > > > Hi Julien, > > > > It is assumed that you already know your rotation. This, in your case > > would be the position/rotation of the plane. So, assume your Plane is at > > plX,plY,plZ and is rotated by prX, prY, prZ. > > > > Your camera position would be behind the plane so plX, plY - > > CameraDistance, plZ. You would have an offset camera position of > > 0,CameraDistance,0. > > > > So of you had a point class with the RotatePoint() function you could > > use... > > > > CMyPoint CameraOffset; > > > > CameraOffset.x = 0; > > CameraOffset.y = -5; (distance of camera) > > CameraOffset.z = 0; > > > > CameraOffset.RotatePoint(prX,prY,prZ); > > > > This would take your camera offset and rotate it around Zero... You can > > then move your camera to that point which would be > > > > CameraOffset.xRotated + plX , CameraOffset.yRotated + plY , > > CameraOffset.zRotated + plZ > > > > This is the actual position of the camera to place it behind the plan. > > You then need to rotate the camera at the same angle as your plane using > > whatever code you are using now. > > > > Regards > > > > Richard > > > > On 28/09/2007, *Julien Breton* <julienbreton@xxxxxxxxxx> wrote: > > > > > > Hello, > > > > Thanks for your code, > > > > I have a question, > > When you have calculate xRotated, yRotated and zRotate give you the > > values to glRotatef function ? (ex : glRotatef (xRotated, 1.0, 0.0, 0.0)), > > may be I can use gluLookAt? > > > > Thanks, > > > > Julien. > > > > ------------------------------ > > Date: Thu, 27 Sep 2007 11:07:06 +0100 > > From: richard.sabbarton@xxxxxxxxx > > To: gameprogrammer@xxxxxxxxxxxxx > > Subject: [gameprogrammer] Re: flight simulation camera > > > > Hi There, > > > > I had exactly the same problem recently because I was making some > > calculations in the wrong order. The problem was with the glTranslate and > > glRotate. I tend to rotate the world around the camera rather than the > > camera around the world. So I will first do a glTranslate/rotate to move to > > the point you want to draw your plane. Then do a glPushMatrix() and render > > the rest of your scene. Once the rest of your scene is drawn then you can > > do glPopMatrix() and then render the plane. It should always be right where > > you want it to be. > > > > I am just a beginner really. But this is how I would do this. There > > are probably better ways. > > > > The problem I ran into was the start point of ammo when firing. I > > wanted my bullets to appear to fire from underneath you but, when looking > > down, they started right in front of you. And when looking up you couldn't > > see them all. Sounds like a similar issue. The problem is that you know > > the angle of your plane and you know the distance behind it that you want to > > move but what you need calculate is the x,y,z of the camera. In the same > > way I needed to calculate the x,y,z of my ammo start point. I wrote the > > following code to rotate a 3D point as part of a 3D point class I was > > working on. > > > > > > > > // x,y,z are members of a 3D Point Class as are xRotated > > // yRotated and zRotated. We use the rotated points for > > // rendering but we leave the original x,y,z unchanged > > // to avoid any distortion. > > > > RotatePoint(int DegAroundX, int DegAroundY, int DegAroundZ){ > > > > // Define some variables needed to perform the rotation > > FLOAT oldx,oldy,oldz,newx,newy,newz,alpha; // We need to use FLOAT > > values for accuracy > > > > oldx = x; > > oldy = y; > > oldz = z; > > > > // ROTATE AROUND Y FIRST; > > alpha = (FLOAT)DegAroundY / (FLOAT)57.29578; // We have to divide > > Degrees by 57.29578 > > // to convert to radians > > newx = cos(alpha)*oldx - sin(alpha)*oldz; > > newy = oldy; > > newz = sin(alpha)*oldx + cos(alpha)*oldz; > > > > oldx = newx; // After each rotation we have to ensure > > oldy = newy; // that the new values are pushed into the > > oldz = newz; // old values because otherwise we will be > > // rotating partially rotated values. > > > > // Then Around X; > > alpha = (FLOAT)DegAroundX / (FLOAT)57.29578; > > newz = cos(alpha)*oldz - sin(alpha)*oldy; > > newy = sin(alpha)*oldz + cos(alpha)*oldy; > > newx = oldx; > > > > oldx = newx; > > oldy = newy; > > oldz = newz; > > > > // Then Around Z; > > alpha = (FLOAT)DegAroundZ / (FLOAT)57.29578; > > newx = cos(alpha)*oldx - sin(alpha)*oldy; > > newy = sin(alpha)*oldx + cos(alpha)*oldy; > > newz = oldz; > > > > xRotated = newx; > > yRotated = newy; > > zRotated = newz; > > > > } > > > > I apologise for the minimal comments. cos, sin & tan were giving me a > > headache by the time I was done. I started putting a repository of notes > > and stuff on my website. You can take a look at it here. > > http://www.fullonsoftware.co.uk/main.html. I put them in my Snippets > > section. Lots of my beginners stuff about openGL and C++. Plus some > > screenshots of my (now stalled) most recent project. > > > > Regards > > > > Richard > > > > > > On 27/09/2007, *Julien Breton* <julienbreton@xxxxxxxxxx> wrote: > > > > Thanks for your answer, > > > > My probleme is that my camera don't stay locked to the plane. When I > > start my exe the camera is behind the plane but when I turn the plane around > > the Y axe (in global coordinates) the camera moves but don't stay behind the > > plane. I can always see the plane but on the right (or left) and front at > > the end but I want stay behind the plane. > > It's not easy to explain and sorry for my English. > > I use C++/OpenGL > > > > Julien > > > > > From: david@xxxxxxxxxxx > > > To: gameprogrammer@xxxxxxxxxxxxx > > > Subject: [gameprogrammer] Re: flight simulation camera > > > Date: Thu, 27 Sep 2007 09:40:31 +0200 > > > > > > On Thursday 27 September 2007, Julien Breton wrote: > > > > > > > > Hello, > > > > > > > > Do you know where I can find an example of a flight simulation > > > > camera ? > > > > > > What do you mean, exactly? > > > > > > From what I've seen, the basic logic of how the camera works in > > > simulators (flight, racing etc) is that it's simply locked to the > > > vehicle, ie it sits where the pilot/driver would be, looking straight > > > ahead. > > > > > > In racing simulators, it's common to add minor adjustments to the > > > position and view angle of the camera, to hint about the G-forces > > > that are "lost in transmission". (Lost, unless you're using a moving > > > platform, that is.) I suppose you could do that in a flight simulator > > > too, but I can't remember seeing that. X-Plane has a different > > > solution: Blackout and redout is simulated by fading the view to > > > black and red respectively. Simple and effective. (Not very not > > > relevant to racing though, as you'd normally never get that kind of > > > G-forces on the vertical axis in a car for extended periods of time.) > > > > > > > > > //David Olofson - Programmer, Composer, Open Source Advocate > > > > > > .------- http://olofson.net - Games, SDL examples -------. > > > | http://zeespace.net - 2.5D rendering engine | > > > | http://audiality.org - Music/audio engine | > > > | http://eel.olofson.net - Real time scripting | > > > '-- http://www.reologica.se - Rheology instrumentation --' > > > > > > --------------------- > > > To unsubscribe go to http://gameprogrammer.com/mailinglist.html > > > > > > > > > > ------------------------------ > > Soyez parmi les premiers à essayer Windows Live Mail. Windows Live > > Mail.<http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d> > > > > > > > > ------------------------------ > > Soyez parmi les premiers à essayer Windows Live Mail. Windows Live > > Mail.<http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d> > > > > > > > > ------------------------------ > > Exprimez-vous en direct avec Windows Live Messenger ! Windows Live > > Messenger > > !<http://imagine-msn.com/messenger/launch80/default.aspx?locale=fr-fr&source=joinmsncom/messenger> > > > > -- Reply, (r)(((???£ Ŝǖ"v@ˉ˘MśĦ ¢ ???)))(c)