Class SpacecraftCamera

  • All Implemented Interfaces:
    IObserver, ICamera

    public class SpacecraftCamera
    extends AbstractCamera
    implements IObserver
    Implements a spacecraft-like movement. The spacecraft is modeled as a rigid solid and it has a mass and an engine model. The rest is physics.
    • Field Detail

      • direction

        public Vector3d direction
        Direction and up vectors
      • up

        public Vector3d up
        Direction and up vectors
      • relpos

        public Vector3d relpos
        Direction and up vectors
    • Constructor Detail

      • SpacecraftCamera

        public SpacecraftCamera​(CameraManager parent)
    • Method Detail

      • getCamera

        public com.badlogic.gdx.graphics.PerspectiveCamera getCamera()
        Description copied from interface: ICamera
        Returns the perspective camera.
        Specified by:
        getCamera in interface ICamera
        Returns:
        The perspective camera.
      • setCamera

        public void setCamera​(com.badlogic.gdx.graphics.PerspectiveCamera cam)
        Description copied from interface: ICamera
        Sets the active camera
        Specified by:
        setCamera in interface ICamera
      • getFrontCameras

        public com.badlogic.gdx.graphics.PerspectiveCamera[] getFrontCameras()
        Specified by:
        getFrontCameras in interface ICamera
      • update

        public void update​(double dt,
                           ITimeFrameProvider time)
        Description copied from interface: ICamera
        Updates the camera.
        Specified by:
        update in interface ICamera
        Parameters:
        dt - The time since the las frame in seconds.
        time - The frame time provider (simulation time).
      • updateHard

        public void updateHard​(double dt,
                               ITimeFrameProvider time)
        Updates the position and direction of the camera using a hard analytical algorithm.
        Parameters:
        dt -
        time -
      • convertAngle

        public double convertAngle​(double angle)
      • updatePerspectiveCamera

        protected void updatePerspectiveCamera()
      • getSpeed

        public double getSpeed()
        Description copied from interface: ICamera
        Gets the current velocity of the camera in km/h.
        Specified by:
        getSpeed in interface ICamera
        Returns:
        The velocity in km/h.
      • getFocus

        public IFocus getFocus()
        Description copied from interface: ICamera
        Returns the foucs if any
        Specified by:
        getFocus in interface ICamera
        Returns:
        The foucs object if it is in focus mode. Null otherwise
      • isFocus

        public boolean isFocus​(IFocus cb)
        Description copied from interface: ICamera
        Checks if this body is the current focus
        Specified by:
        isFocus in interface ICamera
        Parameters:
        cb - The body
        Returns:
        Whether the body is focus
      • notify

        public void notify​(Events event,
                           java.lang.Object... data)
        Specified by:
        notify in interface IObserver
      • checkClosest

        public void checkClosest​(IFocus cb)
        Description copied from interface: ICamera
        Called after updating the body's distance to the cam, it updates the closest body in the camera to figure out the camera near
        Specified by:
        checkClosest in interface ICamera
        Overrides:
        checkClosest in class AbstractCamera
        Parameters:
        cb - The body to check
      • resize

        public void resize​(int width,
                           int height)
        Specified by:
        resize in interface ICamera