The game's camera. Right now you can use it to shake the camera.
Thread: any.
Example
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
Members
| 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. ⚠️ Not tested much in the game yet. |
IsReady (property, bool) | True if the camera can be shaken (the game's code is as expected). |
Kind (property, CameraKind, get) | Which camera is showing the game: Chase, ChaseNear, ChaseFar, Driver, Hood, Bumper, Free, Animated, Replay, or Unknown (a menu, a cutscene). Game thread only. New in 0.12.0. |
Position (property, Vector3?, get) | Where the camera is, in world coordinates; null if it isn't known. Game thread only. New in 0.12.0. |
Forward (property, Vector3?, get) | Which way the driving camera looks, from the last frame drawn with one. Any thread. New in 0.12.0. |
FovScale (property, float, get/set) | The driving cameras' field of view as a multiple of the game's: 1.1 is 10% wider. 0.3 to 3. New in 0.12.0. |
ViewUpdated (event, Action<CameraView>) | Each time a driving camera works out its view, on the thread the game draws from: change the CameraView (Right, Up, Forward, Translation) to move or turn the camera. Keep it short. New in 0.12.0. |
Group (property, int, get/set) | The director's camera mode, as the game numbers it (13 is the replay's cameras); -1 if it isn't known. Setting it switches, as the camera button does. Game thread only. New in 0.12.0. |
ShowReplayShot(byte label) → bool | Switches to the replay's shot label around the car (17 and 19 are slow orbits), as ANNA's cinematic camera does. New in 0.12.0. |
Flash() → bool | The game's white flash between cameras. False while one is on. New in 0.12.0. |
Notes
- 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.
