• ### What is your GameDev Story?

#### Archived

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

# Rigid Camera

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

## Recommended Posts

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 on other sites
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 on other sites
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 on other sites
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 on other sites
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 on other sites
This is an 1D solution. This kind of approach can be applied in 3D. It was just an idea.
By the way, f is not angle, just a factor.

##### Share on other sites
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 on other sites
Well, you can make the camera to turn slower than the plane... But set a limit, if the plane turns quickly.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 14
• 46
• 22
• 27
• ### Forum Statistics

• Total Topics
634044
• Total Posts
3015215
×