Class InteractiveCameraModule
- All Implemented Interfaces:
InteractiveCameraAPI
If you need reproducible results, we recommend the following:
-
Use the transitions API—see
CameraAPI.transition(double[], double[], double[], double)and others in the same family of calls, prefixed by "transition", with the formtransition[...](). -
Manipulate the internal camera state directly with
CameraAPI.set_position(double[]),CameraAPI.set_direction(double[]), andCameraAPI.set_up(double[]). In this case, you need to implement your camera logic in your script. -
Use camera paths (see
CamcorderAPI). - Use key-framed camera paths TODO.
-
Field Summary
Fields inherited from class APIModule
api, em, logger, me, nameModifier and TypeFieldDescriptionprotected final APIv2Reference to API object.protected final EventManagerReference to event manager.protected final Logger.Logprotected final APIModuleReference to self.protected final StringModule name. -
Constructor Summary
ConstructorsConstructorDescriptionInteractiveCameraModule(EventManager em, APIv2 api, String name) Create a new module with the given attributes. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd_forward(double value) Add a forward movement to the camera with the given value.voidadd_forward(long value) voidadd_pitch(double amount) Add a pitch to the camera.voidadd_pitch(long amount) voidadd_roll(double value) Add a roll force to the camera.voidadd_roll(long roll) voidadd_rotation(double dx, double dy) Add a rotation movement to the camera around the current focus, or a pitch/yaw if in free mode.voidadd_rotation(double deltaX, long deltaY) voidadd_rotation(long deltaX, double deltaY) voidadd_turn(double dx, double dy) Add a turn force to the camera (yaw and/or pitch).voidadd_turn(double deltaX, long deltaY) voidadd_turn(long deltaX, double deltaY) voidadd_turn(long deltaX, long deltaY) voidadd_yaw(double amount) Add a yaw to the camera.voidcameraYaw(long amount) voiddispose()Method called whenever the module is disposed.doubleGet the current physical speed of the camera in km/h.voidgo_to_object(com.badlogic.ashley.core.Entity object, double solidAngle, int waitTimeSeconds, AtomicBoolean stop) Version ofgo_to_object(Entity, double, float, AtomicBoolean)that gets thewaitTimeSecondsas an integer instead of a float.voidgo_to_object(String name) Run a seamless trip to the object with the namefocusNameuntil the object view angle is20 degrees.voidgo_to_object(String name, double sa) Run a seamless trip to the object with the namefocusNameuntil the object view angleviewAngleis met.voidgo_to_object(String name, double sa, float wait) Run a seamless trip to the object with the namefocusNameuntil the object view angleviewAngleis met.voidgo_to_object(String name, double solidAngle, int waitTimeSeconds) Same asgo_to_object(String, double, float), but using an integer forwaitTimeSeconds.voidgo_to_object(String name, double solidAngle, int waitTimeSeconds, AtomicBoolean stop) Version ofgo_to_object(String, double, int)that gets an optionalAtomicBooleanthat enables stopping the execution of the call when its value changes.voidgo_to_object(String name, long solidAngle, float waitTimeSeconds) Same asgo_to_object(String, double, float), but using a long forsolidAngle.voidgo_to_object(String name, long solidAngle, int waitTimeSeconds) Same asgo_to_object(String, double, float), but using an integer forwaitTimeSeconds, and a long forsolidAngle.voidland_at_location(com.badlogic.ashley.core.Entity entity, double longitude, double latitude, AtomicBoolean stop) voidland_at_location(com.badlogic.ashley.core.Entity object, String locationName, AtomicBoolean stop) voidland_at_location(String name, double longitude, double latitude) Land on the object with the givenname, if it is a planet or moon, at the location specified in by [latitude, longitude], in degrees.voidland_at_location(String name, String location) Land on the object with the givenname, if it is a planet or moon, at the location with the given name, if it exists.voidland_at_location(String name, String locationName, AtomicBoolean stop) voidland_on(com.badlogic.ashley.core.Entity object, AtomicBoolean stop) voidLand on the object with the given name, if it is a planet or moon.voidrotation_speed_setting(float speed) Change the speed of the camera when it rotates around a focus.voidrotation_speed_setting(int speed) voidset_cinematic(boolean cinematic) Enable/disable the cinematic camera mode.voidspeed_setting(float speed) Change the speed multiplier of the camera and its acceleration.voidspeed_setting(int speed) voidturning_speed_setting(float speed) Change the turning speed multiplier of the camera.voidturning_speed_setting(int speed)
-
Constructor Details
-
InteractiveCameraModule
Create a new module with the given attributes.- Parameters:
api- Reference to the API class.name- Name of the module.
-
-
Method Details
-
set_cinematic
public void set_cinematic(boolean cinematic) Description copied from interface:InteractiveCameraAPIEnable/disable the cinematic camera mode. The cinematic camera mode makes the camera use acceleration and momentum, leading to very smooth transitions and movements. This is the ideal camera to use when recording camera paths or presenting to an audience.- Specified by:
set_cinematicin interfaceInteractiveCameraAPI- Parameters:
cinematic- Whether to enable or disable the cinematic mode.
-
go_to_object
Description copied from interface:InteractiveCameraAPIRun a seamless trip to the object with the namefocusNameuntil the object view angle is20 degrees.Warning: This method is not deterministic. It is implemented as a loop that sends 'camera forward' events to the main thread, running in a separate thread. If you need total synchronization and reproducibility, look into the
BaseModule.park_runnable(String, Runnable)family of calls.- Specified by:
go_to_objectin interfaceInteractiveCameraAPI- Parameters:
name- The name or id (HIP, TYC, sourceId) of the object.
-
go_to_object
Description copied from interface:InteractiveCameraAPIRun a seamless trip to the object with the namefocusNameuntil the object view angleviewAngleis met. If angle is negative, the default angle is20 degrees.Warning: This method is not deterministic. It is implemented as a loop that sends 'camera forward' events to the main thread, running in a separate thread. If you need total synchronization and reproducibility, look into the
BaseModule.park_runnable(String, Runnable)family of calls.- Specified by:
go_to_objectin interfaceInteractiveCameraAPI- Parameters:
name- The name or id (HIP, TYC, sourceId) of the object.sa- The target solid angle of the object, in degrees. The angle gets larger and larger as we approach the object.
-
go_to_object
Description copied from interface:InteractiveCameraAPIRun a seamless trip to the object with the namefocusNameuntil the object view angleviewAngleis met. If angle is negative, the default angle is20 degrees. IfwaitTimeSecondsis positive, it indicates the number of seconds to wait (block the function) for the camera to face the focus before starting the forward movement. This very much depends on theturn velocityof the camera. SeeInteractiveCameraAPI.turning_speed_setting(float).Warning: This method is not deterministic. It is implemented as a loop that sends 'camera forward' events to the main thread, running in a separate thread. If you need total synchronization and reproducibility, look into the
BaseModule.park_runnable(String, Runnable)family of calls.- Specified by:
go_to_objectin interfaceInteractiveCameraAPI- Parameters:
name- The name or id (HIP, TYC, sourceId) of the object.sa- The target solid angle of the object, in degrees. The angle gets larger and larger as we approach the object.wait- The seconds to wait for the camera direction vector and the vector from the camera position to the target object to be aligned.
-
go_to_object
Same asgo_to_object(String, double, float), but using an integer forwaitTimeSeconds. -
go_to_object
Same asgo_to_object(String, double, float), but using an integer forwaitTimeSeconds, and a long forsolidAngle. -
go_to_object
Same asgo_to_object(String, double, float), but using a long forsolidAngle. -
go_to_object
Version ofgo_to_object(String, double, int)that gets an optionalAtomicBooleanthat enables stopping the execution of the call when its value changes. -
go_to_object
public void go_to_object(com.badlogic.ashley.core.Entity object, double solidAngle, int waitTimeSeconds, AtomicBoolean stop) Version ofgo_to_object(Entity, double, float, AtomicBoolean)that gets thewaitTimeSecondsas an integer instead of a float. -
add_forward
public void add_forward(double value) Description copied from interface:InteractiveCameraAPIAdd a forward movement to the camera with the given value. If value is negative the movement is backwards.This gets a unitless parameter in [-1, 1] to mimic the mouse scroll movement up and down.
- Specified by:
add_forwardin interfaceInteractiveCameraAPI- Parameters:
value- The magnitude of the movement, between -1 and 1.
-
add_forward
public void add_forward(long value) -
add_rotation
public void add_rotation(double dx, double dy) Description copied from interface:InteractiveCameraAPIAdd a rotation movement to the camera around the current focus, or a pitch/yaw if in free mode.If the camera is not using the cinematic behaviour (
InteractiveCameraAPI.set_cinematic(boolean), the rotation movement will not be permanent. Use the cinematic behaviour to have the camera continue to rotate around the focus.This method gets two unitless parameters in [0, 1],
deltaXanddeltaY, which mimic the delta, in pixels, of the mouse cursor being dragged.- Specified by:
add_rotationin interfaceInteractiveCameraAPI- Parameters:
dx- The x component, between 0 and 1. Positive is right and negative is left.dy- The y component, between 0 and 1. Positive is up and negative is down.
-
add_rotation
public void add_rotation(double deltaX, long deltaY) -
add_rotation
public void add_rotation(long deltaX, double deltaY) -
add_roll
public void add_roll(double value) Description copied from interface:InteractiveCameraAPIAdd a roll force to the camera.- Specified by:
add_rollin interfaceInteractiveCameraAPI- Parameters:
value- The intensity of the roll.
-
add_roll
public void add_roll(long roll) -
add_turn
public void add_turn(double dx, double dy) Description copied from interface:InteractiveCameraAPIAdd a turn force to the camera (yaw and/or pitch). If the camera is in focus mode, it permanently deviates the line of sight from the focus until centered again.If the camera is not using the cinematic behaviour (
InteractiveCameraAPI.set_cinematic(boolean), the turn will not be permanent. Use the cinematic behaviour to have the turn persist in time.- Specified by:
add_turnin interfaceInteractiveCameraAPI- Parameters:
dx- The x component, between 0 and 1. Positive is right and negative is left.dy- The y component, between 0 and 1. Positive is up and negative is down.
-
add_turn
public void add_turn(double deltaX, long deltaY) -
add_turn
public void add_turn(long deltaX, double deltaY) -
add_turn
public void add_turn(long deltaX, long deltaY) -
add_yaw
public void add_yaw(double amount) Description copied from interface:InteractiveCameraAPIAdd a yaw to the camera. Same asInteractiveCameraAPI.add_turn(double, double)with deltaY set to zero.- Specified by:
add_yawin interfaceInteractiveCameraAPI- Parameters:
amount- The amount.
-
cameraYaw
public void cameraYaw(long amount) -
add_pitch
public void add_pitch(double amount) Description copied from interface:InteractiveCameraAPIAdd a pitch to the camera. Same asInteractiveCameraAPI.add_turn(double, double)with deltaX set to zero.- Specified by:
add_pitchin interfaceInteractiveCameraAPI- Parameters:
amount- The amount.
-
add_pitch
public void add_pitch(long amount) -
get_speed
public double get_speed()Description copied from interface:InteractiveCameraAPIGet the current physical speed of the camera in km/h.- Specified by:
get_speedin interfaceInteractiveCameraAPI- Returns:
- The current speed of the camera in km/h.
-
speed_setting
public void speed_setting(float speed) Description copied from interface:InteractiveCameraAPIChange the speed multiplier of the camera and its acceleration. This setting affects the camera speed in interactive mode, and all the functions that move the camera forward or backward in this module.- Specified by:
speed_settingin interfaceInteractiveCameraAPI- Parameters:
speed- The new speed, from 0 to 100.
-
speed_setting
public void speed_setting(int speed) -
rotation_speed_setting
public void rotation_speed_setting(float speed) Description copied from interface:InteractiveCameraAPIChange the speed of the camera when it rotates around a focus. This setting affects the rotation speed of the camera in interactive mode, and the functionInteractiveCameraAPI.add_rotation(double, double).- Specified by:
rotation_speed_settingin interfaceInteractiveCameraAPI- Parameters:
speed- The new rotation speed in [0,100]
-
rotation_speed_setting
public void rotation_speed_setting(int speed) -
turning_speed_setting
public void turning_speed_setting(float speed) Description copied from interface:InteractiveCameraAPIChange the turning speed multiplier of the camera. This setting affects the turning speed in interactive mode, and the functionsInteractiveCameraAPI.add_turn(double, double),InteractiveCameraAPI.add_pitch(double),InteractiveCameraAPI.add_yaw(double), andInteractiveCameraAPI.add_roll(double).- Specified by:
turning_speed_settingin interfaceInteractiveCameraAPI- Parameters:
speed- The new turning speed, from 1 to 100.
-
turning_speed_setting
public void turning_speed_setting(int speed) -
land_on
Description copied from interface:InteractiveCameraAPILand on the object with the given name, if it is a planet or moon. The land location is determined by the line of sight from the current position of the camera to the object.- Specified by:
land_onin interfaceInteractiveCameraAPI- Parameters:
name- The proper name of the object.
-
land_on
-
land_at_location
Description copied from interface:InteractiveCameraAPILand on the object with the givenname, if it is a planet or moon, at the location with the given name, if it exists.- Specified by:
land_at_locationin interfaceInteractiveCameraAPI- Parameters:
name- The proper name of the object.location- The name of the location to land on
-
land_at_location
-
land_at_location
public void land_at_location(com.badlogic.ashley.core.Entity object, String locationName, AtomicBoolean stop) -
land_at_location
Description copied from interface:InteractiveCameraAPILand on the object with the givenname, if it is a planet or moon, at the location specified in by [latitude, longitude], in degrees.- Specified by:
land_at_locationin interfaceInteractiveCameraAPI- Parameters:
name- The proper name of the object.longitude- The location longitude, in degrees.latitude- The location latitude, in degrees.
-
land_at_location
public void land_at_location(com.badlogic.ashley.core.Entity entity, double longitude, double latitude, AtomicBoolean stop) -
dispose
-