Rotate the player camera towards an object

I am creating a FPS and basically what i want to do is, when the player moves into a trigger volume player’s camera rotate towards an object.

Unfortunately after hours of playing around with blueprint didn’t helped at all.

Here is the blueprint i came up with and it doesn’t work.

http://i.imgur.com/rhRgGtm.png

right now i am using an input event to call it manually, and trying to move the camera.
Thanks.

1 Like

You try to rotate the Character and not the Camera it self. I’m not sure but I don’t think this would work with the Character.

You could try to rotate the Player Camera (get Player Character → cast to myPlayer → get FirstPersonCamera → set Rotation).

Also you could check out to set the controll rotation. But I’m only guessing.

ok, i was able to rotate them after some experiment with their control:

http://i.imgur.com/1bu9dZU.png

it works at the first, but after i set the camera and player control back everything resets back to where it was. I want it to stay like that after the rotation animation completes. Any idea?

The first and easiest solution would be remove the connection from timeline finish. And make a custom event to reset ControlRotation.

I think you want to make something like this? You probably trigger the event from your Level Blueprint by calling a custom event in your player character. So you probably also know in your Level Blueprint when it should end so you can call the same way to reset it.

Or if it is alwas the same lenght, you could make the Timeline this lenght and stick to the blueprint you currently using.

Also you maybe should try the CinematicMode.

But as I said in the first comment, I’m just guessing :smiley:

It sounds like the controller doesn’t follow the rotation if the camera, and when you return camera control to the controller you go back to how it was.

I have two ideas, not sure if they would work, though.
For one, in your finish branch you could set the control’s rotation to be the same as that if the camera before setting the 2 bools back to how they were.
Or you could try setting the control’s rotation instead of the the camera’s in your timeline updates.

@KAEPS133 unfortunately that was not what i was looking for. but thanks :slight_smile:

Or you could try setting the control’s rotation instead of the the camera’s in your timeline updates.

this works :slight_smile: setting control’s rotation works like charm. I was able to reduce a huge amount of codes by doing it this way.

Here is my final bluescript:

Ok, after @AdamBors suggestion i was able to solve it. Here is my final bluescript, this might help someone facing the same problem.

http://i.imgur.com/8b0Xw9A.png

what it basically does is rotate the player camera toward a given target’s location.

Brother, I tried it for three days. You saved me with this article. Thank you so much. Do you still use this method? There is still a better method. Thank you anyway. You are my savior.

Can I just point out that the timeline in the image above is not doing anything. I know this is like 6 years old now but had to point it out so newbies don’t include it if copying the above image. You could have a float inside the timeline (0-1) that controls the Delta time of the Rinterp node. But if you say it’s working with the ‘Get World Delta Seconds’ node then you could remove the timeline altogether here, then, after the Set control Rotation node, have a delay for however long you need it, then Rinterp back to the initial rotation maybe.