How to connect the camera to a character?

So i made a function that sets offsets x,y,z the a actor and sets the camera location and rotation, but how do i make my character be the target of the function?

Is this script being run in the character’s event graph?

Yes, it’s an induvidual blueprint with only the camera as a component. Its in the event graph, yes.

Could you upload a screenshot of the function itself?

By character you mean the player-character, right? (and not a different pawn actor with its own AI)

Did you try by just parenting a camera to the character (your character blueprint) and adjust its offset and other custom characteristics from its “Details Panel” like this?

121322-sprin1.png

If you click on the “Viewport” tab you can see an updated feed of where the camera is positioned whenever you fiddle with its options. In this case, instead of parenting the camera to the mesh model of the player-character, it is parented to a “SpringArm” that detects collisions and pans into the character whenever something solid pushes it in. I believe it is easier this way instead of making a function for it, and you have better control of where the camera will be in relation to the position of the player-character.

If this is not what you are looking for and you want to still use a function to call the shots, I hope you still consider this easier workaround. You can make as many cameras as you like and parent them to any and each different characters in your scene, but if it is a camera that is bound temporally to a character, this will not be useful as the parenting is permanent (unless there is a way to bound/unbound it from the character with a function).

I think you need to use a spring arm instead of setting the offset manually,
Set the spring arm to the height you want it (like the back of the characters head), attach the camera to the Spring arm, and set the offset on the spring arm, it will keep the camera at the offset you want it, hope that helps

if i’m reading what you said properly hakuryuu thats not entirely accurate, you can switch component parents with a detach from component node in the event graph, (i use it with my projectile spawn point on the end of my first person gun and the third person gun), on the original point, you can also set the arm length and offset in the event graph if you want it to change for some reason (like switching perspectives) like this

other than that the other pictures that hakuryuu sent would have been what i put up, you can see the target arm length (how far the camera is from the actor you have it attached to, and the offset (how far left/right/up/down/rotation) of the camera