Camera interpolation
Controls
- ⎵ to switch to the next camera
- ← and → to switch to the next/previous camera
Description
Change the camera position and characteristics. The transition to another position is done using a linear interpolation.
val percent = compute() //. progress of the interpolation
// Interpolation of the camera's transform (ie: position)
val transformation = Interpolations.interpolate(
targetEntity.position.localTransformation,
entity.position.localTransformation,
percent
)
entity.position.setLocalTransform(transformation)
// Interpolation of the Field Of View (fov) of the camera
val targetFov = targetEntity.get(CameraSpot::class).camera.fov
camera.fov = Interpolations.interpolate(targetFov, camera.fov, percent)