I’m currently attempting to teleport my currently controlled pawn from one location to another. The target location is marked by an empty actor ball, which (in theory) should provide me with the location I want to teleport to during runtime:
However, I get a completely incorrect location when using either GetActorLocation or GetWorldLocation. Both functions produce the same result as shown here:
Using this incorrect location, it spawns me in yet another unforeseen location here:
So here I have two actors – one with tag Spawn_1, where I’d like my pawn to teleport to, and Lookat which is where the pawn should be looking after teleporting.
Excuse my ignorance, but does this signify the bounds of my map, even though it, in reality, extends much farther than that yellow box? How do I expand this yellow box?
When I manually put in the locations of both the spawn and look at actors for my teleport function, it put me somewhere completely on the other side of the map… is it possible that the origin is being reset to some location when I launch my game?
(0, 0, 0) seems to be the “Player Start”, so I think that’s where its setting the origin. Interesting.
Excuse my ignorance, I suppose I don’t quite understand how root components work, then. Would I need to, then, get the root component of the actors I want to teleport / teleport to instead of how I was doing it prior?
Update: So I navigated to the point where I wanted to teleport to in the game, and I printed to the screen the current location. When I manually put that location in my blueprint, it “snaps” me to light post, similar to how it was “snapping” me to the trees. Why is my pawn melding itself to the side of objects after the teleport?
It depends how that actor moves / behaves. Typically you want blueprint to be self contained, meaning the root has everything inside attached, but enabling physics, for example, bfeaks that connection. So you might think the actor (root component) location is X, but the component (could be the camera or any visible mesh) is X + Y.
What you did above is not wrong, you just have to confirm the components are where you think they are so they move coherently.
Idk. What I do know is that pawns do not have free will… it’s only doing what you are telling it to do.