Repository navigation
Camera
Bartholomew Ho edited this page Nov 9, 2026
·
1 revision
The game's camera. Right now you can use it to shake the camera.
Thread: any.
Shake the camera while you go faster than 300 km/h.
protected override void OnInit()
{
Game.Tick += () =>
{
var fast = Player.Car is { } car && car.SpeedKmh > 300;
Camera.Shake = fast ? 1f : 0f;
};
}Protected Overrides Sub OnInit()
AddHandler Game.Tick, Sub()
Dim car = Player.Car
Dim fast = car IsNot Nothing AndAlso car.SpeedKmh > 300
Camera.Shake = If(fast, 1.0F, 0.0F)
End Sub
End Sub| Member | What it does |
|---|---|
Shake (property, float, get/set) |
How hard the camera shakes. 0 is still, 1 is a good rumble (peaks at about half a degree), more for more. |
IsReady (property, bool) |
True if the camera can be shaken (the game's code is as expected). |
- The shake works in the driver, hood, bumper and chase views. Other views don't shake.
- The shake fades in (about 0.2 seconds) and back out (about 0.4 seconds) by itself. Just set a value, then set it back to 0.
-
Shakeis kept between 0 and 10. A value that isn't a real number (likeNaN) becomes 0. - Setting
ShakethrowsInvalidOperationExceptionif the game isn't ready yet (still loading, or an unsupported game build). Setting it fromGame.Tickis safe. - If your mod is reloaded, the shake stops.
- On a game build the SDK doesn't support, the shake switches itself off:
IsReadystays false andplatform.logsays so. If only some cameras could be set up, the log says it may work in some views only.
Playing
Getting started
Writing mods
The FH2 classes
- Game
- Player
- Vehicle
- World
- Garage, CarCatalog, Profile
- UI and Hud
- Camera
- Audio
- ANNA
- Skills
- DebugOverlay
- Controller
- GameInput
- GameWindow
- Menus and UiElement
- SettingsTile
- ButtonIcons and Picture
- MapView, PhotoCamera, GarageCamera
More