31 lines
1.5 KiB
Python
31 lines
1.5 KiB
Python
import unreal
|
|
|
|
|
|
def look_at(actor, target):
|
|
actor.set_actor_rotation(unreal.MathLibrary.find_look_at_rotation(
|
|
actor.get_actor_location(), unreal.Vector(*target)), False)
|
|
|
|
|
|
def create(scene, location=(450, -550, 300), target=(0, 0, 100), focal_length=45):
|
|
actor = scene.spawn(unreal.CineCameraActor, "Camera", location)
|
|
component = actor.get_cine_camera_component()
|
|
filmback = component.get_editor_property("filmback")
|
|
filmback.set_editor_property("sensor_width", 36.0)
|
|
filmback.set_editor_property("sensor_height", 20.25)
|
|
component.set_editor_property("filmback", filmback)
|
|
component.set_editor_property("current_focal_length", float(focal_length))
|
|
focus = component.get_editor_property("focus_settings")
|
|
focus.set_editor_property("focus_method", unreal.CameraFocusMethod.DISABLE)
|
|
component.set_editor_property("focus_settings", focus)
|
|
settings = component.get_editor_property("post_process_settings")
|
|
settings.set_editor_property("override_auto_exposure_bias", True)
|
|
settings.set_editor_property("auto_exposure_bias", 0.0)
|
|
settings.set_editor_property("override_auto_exposure_min_brightness", True)
|
|
settings.set_editor_property("override_auto_exposure_max_brightness", True)
|
|
# Extended luminance range interprets these as EV100, not linear brightness.
|
|
settings.set_editor_property("auto_exposure_min_brightness", 8.0)
|
|
settings.set_editor_property("auto_exposure_max_brightness", 8.0)
|
|
component.set_editor_property("post_process_settings", settings)
|
|
look_at(actor, target)
|
|
return actor
|