Coder Social home page Coder Social logo

mwsmoothcamera's Introduction

RTS Camera logo

MWSmoothCamera

An RTS-like smooth camera plugin for Unreal Engine

Table of Contents

Required Setup

  1. Install the plugin by cloning or downloading this repo and place in the Plugins directory of your project
  2. Restart your editor (you will likely be prompted)
  3. Check that the plugin is enabled by going to Edit -> Plugins
  4. Create your own custom GameMode blueprint so you can override the default Pawn and PlayerController Blueprints
  5. Create a new blueprint that extends PlayerController
    • Set Show Mouse Cursor to true so the cursor remains visible in game
  6. Create a new blueprint that extends Pawn
    • In the components section (top of left sidebar), add a new MWSmoothCameraComponent to your default scene root
  7. In the World Settings for your level, override the GameMode with yours
    • Set the PlayerController to your new PlayerController blueprint
    • Set the Pawn to your new Pawn blueprint
  8. In Edit -> Editor Settings -> Input add the following input mappings:
Name Input
RotateCamera Middle Mouse Button
  1. Add the following axis mappings as well:

MoveCameraLeftRight

Input Axis
Right 1.0
Left -1.0
D 1.0
A -1.0

MoveCameraUpDown

Input Axis
Up 1.0
Down -1.0
W 1.0
S -1.0

ZoomCamera

Input Axis
Mouse Wheel Axis -1.0
  1. In your PlayerController or your Pawn, connect your newly defined input events with the corresponding MWSmoothCameraComponent methods
    • Note: if you handle input in your player controller, you will need to get your pawn and then get it's MWSmoothCameraComponent
Input Binding Method
RotateCamera (pressed) RotateCameraPressed
RotateCamera (released) RotateCameraReleased
MoveCameraLeftRight MoveCameraLeftRight
MoveCameraUpDown MoveCameraUpDown
ZoomCamera ZoomCamera

Note: make sure to connect the Axis value in the blueprint to the MWSmoothCameraComponent method!

  1. Press Play to use your new RTS camera!

C++ Support

The plugin is coded in C++ and exposed to Blueprints, so all the same methods are available in C++.

FAQ

  1. I start playing the game and my camera immediately starts moving in a direction, why?
    • This is likely because you have not mapped all the input bindings to MWSmoothCamera methods. Right now a known limitation requires you to map all the above mentioned methods in order to work properly.

Known Limitations

  • Assumed the plugin is used on a desktop Windows game
  • Assumes the player is using a keyboard and mouse
  • If MoveCameraLeftRight and MoveCameraUpDown methods are not bound to the correct inputs, the camera will start moving on play
  • This plugin was built and tested with Unreal Engine 4.26, support is not guaranteed for older or newer versions
  • This plugin was tested in a single-player environment, and has not been tested in a multiplayer game

mwsmoothcamera's People

Contributors

morganwesemann avatar

Stargazers

 avatar Michell René Morsø Christiansen avatar Maximilian avatar

Watchers

James Cloos avatar  avatar

Forkers

curtisjones00

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.