I can't get the camera to follow the character movement.

I’m trying to make the camera in a fixed location but it rotates to follow the character movement. I have followed this tutorial for that:

And here is my full level Blueprint:

I have done everything correctly, I just can’t get why the camera isn’t rotating to the character’s location? How can I make the camera rotates to follow where the character is going??

Hey @wejdanHM! Welcome to the forums!

So what I’m looking at with your code seems like it should work fine. The issue now is the outside factors.

Is the TriggerBox working? Put a print string between the Begin Overlap and the End Overlaps and their respective casts that happen right after.

Also add one after “Rotate the Camera” and pass your “Can rotate” variable in. If it prints “False” then that would be a dead giveaway.

You didn’t really describe what’s happening, only that it didn’t work. If you can go into more detail it will be easier for us to help! :slight_smile:

1 Like

Thank you for your reply. I don’t know why it is not working myself that’s why I couldn’t give details. But yes the TriggerBox works because it changes to the targeted camera when I’m inside the box but the camera isn’t rotating! I will try to print the canRotate variable and will get back to you.


This is how I tested the variable, it gave me an infinite list of the word “true”. So I’m confused, everything seems to be working. but the camera isn’t rotating for some reason.

Ok, great!

Yes, the camera not rotating was the detail we needed. Because there are a few things here- it could be not switching to that camera, it could be showing a black screen, and so on.

Try going off of the “Cast Failed” options on your casts and using a print string there- if it isn’t casting it’s not giving the return object.

If it is not failing, try right clicking the “As Binded Character Top Down” and promoting it to variable, then use that variable as the input for the “Get Actor Location” for the lookat node. :slight_smile:

1 Like

I’m really sorry, but this is my first time using Unreal Engine, so I don’t know what the “cast” you are talking about.

Try going off of the “Cast Failed” options on your casts and using a print string there- if it isn’t casting it’s not giving the return object.

This part I’m not sure how I can do that.

I tried failed casting, when I tested it, it is not printing anything when going inside the trigger box. So I guess this mean the cast isn’t failing?

I have tried promoting the variable to the “Get Actor Location”, like this:

but as you can see there is a new node that got created by itself connected to the “As Binded Character Top Down”, I don’t know how to connect that node!
But I tried testing it anyways, what happened is, when getting inside the trigger box, the camera changes its looking direction but still not rotating.
but I got errors.

I guess the node that I left is what causing this error:
blueprint Runtime Error: “Accessed None trying to read property As Binded Character Top Down”

Ah, yes, it will absolutely give you that error if it’s not given a value!

You simply add it to the line, like so:
image

1 Like

ok, I fixed it and tested the result. It is the same now, the camera is still not rotating :sob: :sob:, I really don’t know what the issue is, but my character isn’t walking for movement, instead it is crawling. Does that have to do with anything? I don’t think how he moves could be a problem, but I have tried troubleshooting multiple times now and all in vain :broken_heart:

Could you show this panel after selecting the CameraActor’s CameraComponent in the level:

image

Is it set to Rotation or Absolute Rotation?

Sure here it is:


u

it is not set to Absolute Rotation. Should it be?

It should not. It should just say Rotation in this case. Besides this being a somewhat poor tutorial with a couple of bad practices, I also do not see why this wouldn’t actually work. It looks like it should, even if it’s not great.

Thinking more along the lines of what else could break this interaction in the way you’ve described.

  • the camera does switch to the correct perspective, right?
  • it just does not rotate, it does not track player movement. Is there perhaps something special about the movement while in the room? Perhaps you move just the character’s mesh rather than the entire character?
  • when you crawl back out of the room, does it switch back to the character’s camera?

In your game, will you be having more rooms / locations / situations where the camera needs to switch to a different perspective? Or is this a unique 1 time only situation that will not get repeated?

* the camera does switch to the correct perspective, right?

Yes it does, and when I’m outside the room it switches back to the previous camera.

How would I know that? How can I check if only the mesh is moving? I can see the character moving but I’m not sure if it is missing something.

yes, it switches back to previous camera, but I don’t have a character camera, every room/ hallway has a camera that all should be fixed and only rotating with the movement.

yes, every room/hallway has a different camera and it should switch to cameras according to where the player is, but all cameras should be in a fixed places but rotating with the player.

My suggestion is to take a different approach. Doing it all 1-by-1 manually in the Level Blueprint is not the best idea. You’d need to repeat this script dozens of times - once for each room / corridor / cut-scene. And your dev time is probably too precious for that.


Consider this alternative where each box trigger already has a camera inside.

  • create an actor with a Camera Component and Box Collision, disable Tick:

No need to adjust camera location or box dimensions at this point.

  • this script goes into the actor:

You can try to copy the script from here:

But you may need to clean it up.

  • you can now place those actors in the world:

  • double click the camera component to adjust its transform:

And you can adjust the box dimension / transform in the details panel, too:

This approach makes the actor reusable so you can plop them down as many times as needed in any level:

This can be further improved, ofc - depends on the desired features and details. Here’s the project link in case you wish to quickly hop in and test out whether that would work for you:

Amazing, thank you so much, but before I start that and give you feedback. Can you please tell me how to make sure I’m not only moving the mesh? because if I’m, then even with these changes I would still get same issue.

1 Like

Could you show the script that is moving the binded character? As in:

This is not a good way to move a player!

Here it is:

but my character movement is kind of different. it is only crawling and looks like a ragdoll movement, so it is kind of complicated.

1 Like

You camera wasn’t working because you’re moving just the mesh, not the player. @Mind-Brain - bet you did not see this coming!

1 Like

isn’t there any way to do that ?, my character is like a ragdoll that’s crawls weirdly, that’s why the mesh was used. So now there isn’t any solution for that? it is hard to change the movement now.

1 Like

isn’t there any way to do that ?, my character is like a ragdoll that’s crawls weirdly

You’d need to replace:

with:


my character isn’t walking for movement, instead it is crawling. Does that have to do with anything?

I should have read this with more comprehension. I was not expecting to see physical simulation.

2 Likes