Class CameraEvent

All Implemented Interfaces:
CinematicEvent, Savable

public class CameraEvent extends AbstractCinematicEvent
A `CameraEvent` is a cinematic event that instantly sets the active camera within a `Cinematic` sequence.
  • Constructor Details

    • CameraEvent

      public CameraEvent()
      For serialization only. Do not use.
    • CameraEvent

      public CameraEvent(Cinematic cinematic, String cameraName)
      Constructs a new `CameraEvent` with the specified cinematic and camera name.
      Parameters:
      cinematic - The `Cinematic` instance this event belongs to (cannot be null).
      cameraName - The name of the camera to be activated by this event (cannot be null or empty).
  • Method Details

    • initEvent

      public void initEvent(Application app, Cinematic cinematic)
      Description copied from class: AbstractCinematicEvent
      Initialize this event (called internally only).
      Specified by:
      initEvent in interface CinematicEvent
      Overrides:
      initEvent in class AbstractCinematicEvent
      Parameters:
      app - ignored
      cinematic - ignored
    • play

      public void play()
      Description copied from class: AbstractCinematicEvent
      Play this event.
      Specified by:
      play in interface CinematicEvent
      Overrides:
      play in class AbstractCinematicEvent
    • onPlay

      public void onPlay()
      Description copied from class: AbstractCinematicEvent
      Implement this method with code that you want to execute when the event is started.
      Specified by:
      onPlay in class AbstractCinematicEvent
    • onUpdate

      public void onUpdate(float tpf)
      Description copied from class: AbstractCinematicEvent
      Implement this method with the code that you want to execute on update (only called when the event is playing).
      Specified by:
      onUpdate in class AbstractCinematicEvent
      Parameters:
      tpf - time per frame
    • onStop

      public void onStop()
      Description copied from class: AbstractCinematicEvent
      Implement this method with code that you want to execute when the event is stopped.
      Specified by:
      onStop in class AbstractCinematicEvent
    • onPause

      public void onPause()
      Description copied from class: AbstractCinematicEvent
      Implement this method with code that you want to execute when the event is paused.
      Specified by:
      onPause in class AbstractCinematicEvent
    • forceStop

      public void forceStop()
      Description copied from class: AbstractCinematicEvent
      Implement this method if the event needs different handling when stopped naturally (when the event reach its end), or when it was force-stopped during playback. By default, this method just calls regular stop().
      Specified by:
      forceStop in interface CinematicEvent
      Overrides:
      forceStop in class AbstractCinematicEvent
    • setTime

      public void setTime(float time)
      Description copied from class: AbstractCinematicEvent
      Fast-forwards the event to the given timestamp. Time=0 is the start of the event.
      Specified by:
      setTime in interface CinematicEvent
      Overrides:
      setTime in class AbstractCinematicEvent
      Parameters:
      time - the time to fast-forward to.
    • getCinematic

      public Cinematic getCinematic()
      Returns the `Cinematic` instance associated with this event.
      Returns:
      The `Cinematic` instance.
    • setCinematic

      public void setCinematic(Cinematic cinematic)
      Sets the `Cinematic` instance for this event.
      Parameters:
      cinematic - The `Cinematic` instance to set (cannot be null).
    • getCameraName

      public String getCameraName()
      Returns the name of the camera that this event will activate.
      Returns:
      The camera name.
    • setCameraName

      public void setCameraName(String cameraName)
      Sets the name of the camera that this event will activate.
      Parameters:
      cameraName - The new camera name (cannot be null or empty).
    • write

      public void write(JmeExporter ex) throws IOException
      Used internally for serialization.
      Specified by:
      write in interface Savable
      Overrides:
      write in class AbstractCinematicEvent
      Parameters:
      ex - The exporter (not null).
      Throws:
      IOException - If an I/O error occurs during serialization.
    • read

      public void read(JmeImporter im) throws IOException
      Used internally for deserialization.
      Specified by:
      read in interface Savable
      Overrides:
      read in class AbstractCinematicEvent
      Parameters:
      im - The importer (not null).
      Throws:
      IOException - If an I/O error occurs during deserialization.