<style>.lazy{display:none}</style> Skip to main content


Unreal Engine C++ Fundamentals – Character possession and changing materials

By Development, Tutorial, Unreal No Comments

Hey guys,

We are back after a short summer break with more tutorials.

Today we go back to our C++ Fundamentals lessons by looking at possession and how we can control different charactesr in our world. In addition to that we are going to setup a few materials so we can change our characters appearance to showcase the possession a bit better.

As usual you can find the start project on our GitHub page.

Possession ? That sounds scary

Don’t worry it’s not halloween yet, and possession is just a fancy term for taking complete control over another character or actor within your game world.

This allows our player to be able to experience different character behaviors, it allows for playing different stories like in GTA 5 or you can use it for simple mount mechanics. Tons of possibilities.

So let’s take a look at how we possess our characters

// save a copy of our controller
AController* SavedController = GetController();
// unpossess first ( helps with multiplayer )
// disable movement mode
// possess our new actor

Seems pretty straight forward but let’s see what is going on here.

First we end up saving a copy of our current player controller so we can reference it later. This can also be used to save the “AI” brain of a character in the world and put it back when we unpossess said character.

We then go ahead and unpossess the current controller to ensure it’s cleaned up.

We then go ahead and set the movement mode on our player to none so he doesn’t move when we leave his body.

And lastly we possess the actor of our choosing.

So what about these materials ? Are they also haunted ?