Coder Social home page Coder Social logo

notle0n / cameracontrol Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 121 KB

A Terraria mod to manipulate the camera.

Home Page: https://steamcommunity.com/sharedfiles/filedetails/?id=2831018225

C# 100.00%
terraria terraria-mod tmodloader tmodloader-mod camera-control

cameracontrol's Introduction

Camera Control

Camera Control is the perfect tool for making showcase, cinematic or youtube videos! It allows you to move the camera along a predefined path, lock the camera to a fixed point or make the camera follow an NPC, Item or Projectile.

If you have any questions, issues or bugs contact me on my discord server

This mod has been split of from the "Better Zoom" mod. If you're looking for a mod to just zoom in/out more, check it out.

How to use

To use this mod you need to enter Editor mode by pressing the Keybind, which you have to set first. In Editor mode, you can freely move the camera with W, A, S or D and zoom in and out using the mouse wheel. The "Show View Range" button will draw a box to show what the player will see at 100% zoom.

You'll also see the UI at the bottom of the screen in Editor mode.

Currently you are in Select mode - to start placing tracks enter Drawing mode, by clicking on one of the two "Place curve" buttons.
draw

You can select between Bézier and (Catmul-Rom) Spline curves. The difference is that Bézier curves will create a smooth curve, where the points of the curve don't have to hit all control points. In comparison, a Spline curve will go through all control points.
comp

After selecting a curve, start drawing by clicking and dragging the mouse to the desired location. When you're done placing, go back to Select mode, by clicking on the currently selected curve type and move the control points to create the curve you want.
control

You can erase curves by clicking on "Erase curve". You will enter Eraser mode where clicking on a curve will remove it. To remove all curves at once, click on "Delete all curves".

Now we have a track the camera will follow. Press the Play button to start or resume. Press it again and the camera will pause at it's current location along the curve.
play

There are a few settings for what will happen at the end. The default behavior is stopping at the end. If you toggle "Repeat", the camera will go back to the start. If you toggle "Bounce", the camera will track backwards towards the start and then start again.
endsettings

While the camera is tracking, a progress bar will show you the percentage to competion. You can quckly scrub through the curve by holding left click and dragging the scroll bar.
progress

To change the speed, use the Speed up and Speed down buttons. This will double or halve the speed of the previous keyframe. This will get us to the Keyframe system.
changespeed

Keyframes

There is always at least one Keyframe present - at the very start. Keyframe are shown on the progress bar as red rectangles. To create a keyframe right click the progress bar at the desired location. To remove a keyframe, right click the keyframe.
keyframes

The tracker will change speed when it passes over a keyframe.

Track Enities

Click on the "Track Entity" button and then select the entity, by clicking on its hitbox (highlighted in green). To stop tracking, hit the button again. You can also cancel the selection process, by clicking on the button again while the hitboxes are shown.
trackentities

Lock camera

You can lock the camera with the "Lock camera" button. The camera will be locked to the current editor camera location, once you leave Editor mode.
lockcam

Hotkeys

There are hotkeys for:

  • Play/Pause
  • Toggle Repeat
  • Toggle Bounce
  • Lock Screen You have to set them to a key to use them.

Saving and Loading curve and keyframe data

Clicking on the "Save curve data to file" button will create a new .json file with the current curve data inside the directory "Documents\My Games\Terraria\tModLoader\CameraControlData". Then with the "Load curve data" button, you can select a file and load it's data into the world. Loading curve data will override all curves and keyframes.
saveload

cameracontrol's People

Contributors

notle0n avatar

Stargazers

 avatar  avatar

Watchers

 avatar

cameracontrol's Issues

Hotkeys

  • Play/Pause
  • Bounce
  • Repeat
  • Lock Screen

Saving/Loading curve data

A way to save to and load curve data from a file.
I could use json to store curves like this:

{
  "curves": [
    {
      "c0": { "X": 33510, "Y": 1542 },
      "c1": { "X": 33621, "Y": 1490 },
      "c2": { "X": 33770, "Y": 1842 },
      "c3": { "X": 33832, "Y": 1902 }
    },
    {
      "c0": { "X": 34510, "Y": 1442 },
      "c1": { "X": 34621, "Y": 1490 },
      "c2": { "X": 34770, "Y": 1442 },
      "c3": { "X": 34832, "Y": 1402 }
    },
  ]
}

Add lock camera

A button to lock the camera at a specific location. Press the same button again to unlock the camera.

Bounce crash

The game crashes when the tracker bounces while in a spline curve.

Logs:

System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at CameraControl.CameraSystem.ModifyScreenPosition() in CameraControl\CameraSystem.cs:line 61
   at Terraria.ModLoader.SystemLoader.ModifyScreenPosition() in tModLoader\Terraria\ModLoader\SystemLoader.cs:line 118
   at Terraria.Main.DoDraw_UpdateCameraPosition() in tModLoader\Terraria\Main.cs:line 49234
   at Terraria.Main.DoDraw(GameTime gameTime) in tModLoader\Terraria\Main.cs:line 48269

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.