Download

Break Hit Result - how is Location different from Impact Point ?

The way I am planning on teleporting an actor is tracing, getting a hit, breaking hit down, getting location and teleporting actor into that location. However, there are 2 locations: Location and Impact Point. While it’s clear what Impact point is, it’s not clear what Location is.

Any idea how Location is different from Impact Point?

Thanks

This might help a bit. When you are using a line trace Location and Impact Point should be the same, but when you are using sweep (basically trace, but using a shape) Location is the Location of the shape, when it Hit something and Impact Location is the Location where the Hit occured. So Impact location is the point where the shape and the object that it hit overlap.

Yeah, I’ve read the description in the docs and I didn’t understand it, so I came here :slight_smile:

So to teleport actor safely (so it doesn’t get stuck in a wall or in another actor), do I need to use MultiCapsule Trace by Channel and Location instead of Impact Point ?

Using a capsule trace will automatically clear room for your character (as long as the capsule has the appropriate size) but it will not go through gaps where it can’t pass through. You won’t be able to teleport through a keyhole, for example, so it depends on your project’s design.

Hmm… How would I go about it if I need to teleport actor through a “keyhole” , but make sure it doesn’t get stuck at the destination point? (destination point would need to be adjusted to a safe location if destination point is in the other’s actor bounds, or too close to it, or too close to a wall)

You’ll need to use a line trace first, then try to calculate a safe location starting from the hit location along the line. That’ll require some vector fudging and extra capsule/box/sphere traces. You could also try cheating and spawning a dummy actor that contains a capsule collision there and set it to adjust spawn location (which will cause UE4 to try to adjust the spawn location so it isn’t overlapping anything) and if it succeeds, you delete the dummy and teleport the player there.

Ah, sounds like a good idea. I’ll try that!

Or I could use capsule trace, and disable collisions on the actor before teleporting it. This way it won’t get stuck in a “keyhole”. Would that work ?

The capsule trace would stop at the keyhole, that’s the thing. It simulates a capsule following a line and tells you if it hit something along the way.

I began poking at it yesterday and I see that I can feed variables into capsule size. Perhaps I could change size on the fly if player going to be teleported through a small opening.

Couldn’t you line trace through the keyhole and get a valid spawn point from the “other side”? If it is a keyhole, and the line trace was to be aimed through it, it would not collide with the object containing the keyhole.

Of course, that requires some precision aiming for your teleportation. May or may not work well for the game you are trying to make. I am in favor of the spawn dummy actor first and have it adjusted to the location, THEN you are put in its place. It’s a little too… messy… without the proxy.

Location: Location of Component or Actor

Impact Location: Location on Component or Actor where the trace line collides with that object.