I’m trying to set a camera location based on the player location, but instead it just returns me the spawn point location, doesn’t matter what cast i do. Any ideas on how to fix?
Can you show the player hierarchy?
I had something like this where the position of the actor from the “get actor location” node did not return where the actor was.
This turned out to be because the “get actor location” node was returning where the root component of the actor was and I had a physics enabled component that was representing the actor.
HTH
What do you mean with player hierarchy? The player indexes? If is it, there is only one, which is the player (0) .
What I want to know is what is the root component of the actor is, You can read more about actor components here.
If i understood what you said is this : https://docs.unrealengine.com/latest/images/Gameplay/HowTo/CharacterMovement/Blueprints/Setup_1/MakeCameraChild.jpg
You meant the player hierarchy , right?
Yip, Thats what I was asking for.
That all looks good (which it should as it is derived from the character class)
I should have asked this from the beginning; Where do you want to place the camera reletive to the player?
You should also be able to get the world position of the capsule component and use that as the reference position.
HTH
Well, i’m creating a pushable block. My plan is to change the player camera when player is grabbing the block, but with a fixated camera on the block i’ll only get the right camera in one face of the block. My plan is to get the player pos and put the camera a little behind him, and fix the camera rotation probably using player camera , which seems to do nothing when i choose the player camera rotation.Also, i want to do it this way because i want to create float variables that allow me to change the camera pos / angle with scrollers.
Have you tried using a attaching the camera to a springarm?
You can then rotate that or just set it to take the players rotation.
HTH
I tried using this setup, i also tried using the nodes that aren’t being used in the screenshot(yes, the springarm node was attached when i tested, i just unplugged it by mistake before taking the screenshot). Also, one thing i didn’t mention is there isn’t a third person character on the world outliner, and whenever i put it to the world it is not the one i’m controlling, so it does nothing. Maybe thats the problem?How can i put one in the world and make this guy my character?
The node setup looks like it should be placing the camera at the actos location.
The character should have a drop down box in its properties called “auto possess player”, Change that to “player 0” should work.
The game/editor will spawn a actor of the type specified by the game mode if the player is not automatically possesed.
HTH
But it’s not, god ****. Dont you have any bright idea to do this?
Not at the moment, I might be able to do better if you can point to a youtube video or something that can help me understand how you want the camera to work.
The only other thing to do is to get down into the nitty gritty details of debugging, Start by placing a break point on the nodes that are used to set the cameras location and check if the values are what is expected.
HTH
I tested something right now, if the target from the transformation is the player camera, everything works fine, but if the target is the blueprint camera from my pushableBox it’ll go to the player spawn. Does that help to solve the problem?
EDIT: i finally got it working(well, the location and rotation are changing now, but i need to fix the project to do exactly what i want):
Basically, the screenshot of the blueprint that triggered the set location and rotation was the event begin, but what makes my character change the view blend to the object camera was the press E on triggerbox. I simply moved what was on event begin to the nodes to the press E on triggerbox.Even though i don’t know why it fixes it. An explanation would be nice
Happy to hear that.
The begin play event is called once when the actor(object) begins play, I think you were storing the locations in the begin play and storing them for later(correct?) which would mean that you only got the actors location on spawn.
Which would then explain why that was always the location used as it was not updated each time the camera was to be moved.