How do i create a teleportation "offset?

My apologies if this is posted in the wrong place. I’m new here.

I’ve attached a screenshot

How do I make it so the player is automatically offset by a certain distance from the teleport target? For example, I don’t want to teleport so close to a photo frame on a wall that my eyeballs are actually touching it. I figured teleporting to the photo and then subtracting x amount from the forward vector would do the trick, and it seems to work as far as I can tell.

Problem: If, for some reason, there is another wall behind me, the player will still back up by x amount and go through a wall then into infinity because it doesn’t know to stop backing up if it collides with another wall or object first.

don’t tried before but one shortcut would be to attach a mesh with your object but with hidden so your line trace will get that location and it will always near to your object not on your object

But that’s not what you’re doing in the screenshot. Old screenshot?


The thing with the Teleport node is that it tries to give you wiggle room and can become unpredictable in close quarters:

You could try setting transform instead.


Problem: If, for some reason, there is another wall behind me, the player will still back up by x amount and go through a wall

Sounds like there simply is not enough space, is there? Or you’re forcing the character into the wall, seeing how you do not use vector math to arrive at the final location. Do note that characters use this depenetration mechanism:

image

They will work hard not to get stuck inside blocking volumes. Perhaps re-jiggle the script to actually use target surface normal. And confirm with visual debugging the target location is large enough to accommodate the character. You could even add a capsule trace to check whether it’s void of obstacles - may not be necessary if we’re working with larger, open and clutter-free spaces, ofc.


Untested :crossed_fingers:, try:

1 Like

I thought I was doing that in the circled area, but I guess not. Thanks for your help. I’ll post my results later tonight (EST)

This looks like it’s gonna work. I cannot wait to try it!

image

This would move the player 90cm towards West. It’s not the player’s / wall’s right or left, it’s a world coordinate.

1 Like

Right. It seems obvious now that you’ve mentioned it.

Aaaaand it worked! Thank you, thank you, thank you!

I was able to test it during lunch and now I can finally move onto the next bit of scripting. Bravo, Sir.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.