Replicating Flight Mechanics of Star Wars Battlefront (2015)
I'm trying to replicate the flight mechanics from Star Wars Battlefront (2015) in Unity and I can't get my head around what exactly is going on. Specifically, how do I get the camera to behave like this using Unity and C#: I don't mind if you don't give code, I'm just struggling to understand what happens and when in terms of camera movements and rotation.
- Decide the desired camera location. In this case a distance
xbehind the fighter plus an offset
yin the up direction relative to the fighter.
ycan depend on the current velocity, but for starters use constant numbers.
- Decide the desired camera “up” rotation. I guess it’s just the rotation of the fighter.
- Write a simple function that takes the current camera location and the desired camera location, then move the camera from the current location towards the desired one. Make the speed of that move dependent on the distance between current and desired location.
- Same as 3 for rotation.
- Take the flight direction of the fighter, add a certain distance to get a point in front of the fighter. Make the camera look at that point. Or use the inverse, make the fighter fly where the camera looks.
The camera tries to follow the fighter, but not in the same speed the fighter moves, a bit slower, with a specific cap. With cap I mean, that the camera seems to have a specific limit for the “deviation angle”.
“Deviation angle” means the angle between the direction vector of the camera and the direction vector of the fighter.
Imagine the camera is bound to the fighter by a kind of “leash”. You can see this at 1:40-2:00 or 2:17-2:29.
To reproduce this I would adjust the orientation of the camera with a delay (slower velocity), maybe interpolated by a simple function (via e.g. animation curves). But with specific bounds, so that the fighter is not able to move out of the camera view. To achieve this you should determine a maximum “deviation angle”. The closer the “deviation angle” comes to maximum, the faster the camera is adjusted up to the maximum speed the figther can move or maybe even faster. You could use an animation curve again, to make it look smoother.
- Database Administration Tutorials
- Programming Tutorials & IT News
- Linux & DevOps World
- Entertainment & General News
- Games & eSport