Archived

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

scottdewald

Rigid Camera

Recommended Posts

scottdewald    163
I am working on a 3D flight game. I have my camera attached to my plane from a 3rd person point of view. When the plane turns, doesn''t look like it is turning that much b/c every move the plane makes, the camera makes the exact same move b/c the camera updates its position and orientation based on the planes (I believe I should be doing this?). I would like to make my camera so that it is not so rigidly attached to my planes (Battlefield 1942 has a good example). Does anyone have any suggestions of what I should?

Share this post


Link to post
Share on other sites
orbano    130
i have never done such thing, but i would apply some kind of force to the camera instead of just moving it. it would be something like the camera would be attached to the plane with a spring (with few modifications, becouse you dont want your camera bouncing around )
It can be easily done:
-Create a spring system described above
-use an extra force (it is called drag i think), wich has a direction opposite to the camera velocity, and magnitude propotional to the velocity (multiplied with a constant value, that you have to test to be good enough, so our camera wont start bouncing, but wont follow the plane too slow).

"Knowledge is no more expensive than ignorance, and at least as satisfying." -Barrin

[edited by - orbano on March 27, 2004 7:03:08 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
1. solution: you could use springdamper model with a large damping so that it will not overshoot. Play with the factors to get the best combination
2. solution: you can use an exponencial following. In this case you will have one factor, say "f".
The angle of the plane is "p", the angle of the camera is "c" at a given frame. Every frame you modify the "c" with the following formula:

c = f * p + (1-f) * c or simpler:

c += f * ( p - c )

Play with f to achieve the best behaviour.
If f==1 then you get your current solution.
With f==0 your camera won''t rotate.

Hope this helps

Share this post


Link to post
Share on other sites
szinkopa    198
1. solution: you could use springdamper model with a large damping so that it will not overshoot. Play with the factors to get the best combination
2. solution: you can use an exponencial following. In this case you will have one factor, say "f".
The angle of the plane is "p", the angle of the camera is "c" at a given frame. Every frame you modify the "c" with the following formula:

c = f * p + (1-f) * c or simpler:

c += f * ( p - c )

Play with f to achieve the best behaviour.
If f==1 then you get your current solution.
With f==0 your camera won''t rotate.

Hope this helps

Share this post


Link to post
Share on other sites
scottdewald    163
quote:
Original post by szinkopa
2. solution: you can use an exponencial following. In this case you will have one factor, say "f".
The angle of the plane is "p", the angle of the camera is "c" at a given frame. Every frame you modify the "c" with the following formula:


Talking about angles ''f'' and ''p'', if I am in 3d space, which angles are these. I am using quaternions by the way.

Share this post


Link to post
Share on other sites
Kapis    122
Since you are using quaternions, you could probably interpolate from the current to the destination (your plane) orientation.

Like szinkopa said, you can interpolate with a scalar 0<=S<=1. So the higher your value, the quicker the camera should "catch up".

Share this post


Link to post
Share on other sites