Cursor Position Gem with example RTS style Camera

Hi everyone,

There have been a handful of requests on how to make a camera behave like an RTS camera. I’ve put together and attached a sample gem to this post.

This exposes an EBus to get the cursor position and a cameracontroller script that uses this EBus to perform a a simple camera translation when the cursor touches an edge of the screen. To get it running you can do the following:

  1. Unzip (attached to this post) and place it in the Gems folder within your Lumberyard directory.

  2. Open the Project Configurator and on your desired project select “Enable Gems”

  3. Navigate to MouseCursorPosition and enable by checking the box next to it

  4. Select “Save” on the upper right of Project Configurator

  5. Run lmbr_waf configure to build the gem into your project

  6. If lmbr_waf configure succeeds rebuild the project by running the following.

  • For Visual Studio 2015 run: lmbr_waf build_win_x64_vs2015_profile -p game

  • For Visual Studio 2013 run: lmbr_waf build_win_x64_vs2013_profile -p game

  1. Run the editor and launch your desired project and Level

  2. Under Asset Browser open the Gems dropdown and find the MouseCursorPosition Gem. Under Assets/Slices you’ll find camera_0.slice which you can drag into the level to create a pre-made camera that contains the sample cameracontroller

  3. Run the game. Camera controls are as follows:

  • Mouse: Scroll wheel - Zoom in and out

  • Mouse: Cursor position - Moves the camera when the cursor touches the edges of the screen minus a configurable offset.

For those interested in how the scroll wheel input is being used take a look at the Input Binding under the Input component on the pre-made camera as well as the OnPressed function in the cameracontroller.lua script. Further documentation on Input Bindings and events can be found here, here, and here.

Detailed documentation on adding and building a Gem into a project can be found here, and here.

I hope this example illustrates the power of gems and how you can add additional scripting functionality through exposing an EBus. (22 KB)

Great to see this kind of content.

I think this and other content and useful examples from the team needs to be put in a more relevant position in the site or may get lost in the thread jungle, especially for newer users.(the ones that may benefit more from this kind of samples).

Please consider posting this kind of content in a specific category where normal users cannot create threads, or write them in the Lumberyard blog in a specific category and post just the announcement in the forum.This just to try to maximize the impact of your efforts.

Thank you for your help,

I tried this gem and when running the editor I have a loading error. I put a screenshot attached.

My lumberyard version is

What should I do ?


Excellent point @Gamely! Thanks for this perspective :slight_smile:

Yikes — let me get you some answers on this :slight_smile:

Hi @SniperWolf,

Thanks for bringing up this issue. The gem was made for 1.10 and relies on functionality not present in 1.8. Is it possible for you to update to 1.10?

Thank you. I’ll update to the last version, I will try the gem and I will post the outcome.


When you enable a Gem that also contains code you need to rebuild the project. Did you only run the configure step? After running configure, try the following:

If you are using VS2015

  • build_win_x64_vs2015_profile -p all
    If you are using VS2013

  • build_win_x64_vs2013_profile -p all
    Also, you can check the gems.json file for a list of enabled Gems. It is located here:

  • …\dev\YOURPROJECT\gems.json

  • If your Gem is not listed in this file, it has not been built.
    Let us know if this works, and good luck!


It does not work. I think the gem was not built (Step 5). Because I can’t find a gem.MouseCursorPosition[].dll

I ran lmbr_waf configure but no gem was built.

What should I do ?

Thank you,




I’ve updated the steps to include rebuilding in VS and added more documentation links. Did you get the Gem to work?

Hi @Scott_LY

It seems that I’m unable to rebuild the project with this gem for, the rebuild error seems to always stop at different point of build process.

Note that I have no issue rebuilding this gem in and before. I wonder if it is no longer compatible with Can you test for me whether you have same issue from your end?

Hi @AwieWings,

Apologies for the delay. I was able to successfully build and use the Gem in Lumberyard Are you still experiencing this issue?

Hey, realize this is an older post, just wondering if this is this still recommended method for top-down style controls. Also some breaking issues in 1.19 MouseCursorPositionComponent.cpp(19) ->SerializerForEmptyClass();
deprecated . . . if SerializeWithNoData() compiles but fails asset processing. Any assistance appreciated.

Also, for drawing a marquee selection box or similar is IUIDraw.h correct, or is there a better solution?

EDIT: Just removed MouseCursorPositionComponent.cpp(19), works fine. Tested 1.20 Many thanks to OP and folks on Lumberyard Discord.