Sombra's teleport - Overwatch
May 11, 2017 | Unreal Engine
For this day project, I recreated Sombra's teleport from Overwatch, and added a multitude of dynamic settings. This would allow a designer to make fast changes on the fly without affecting the base values.
How it works!
This was made using a component. Doing this allowed me to attach it to any character or object, without copying and pasting existing code.
Player InputAction calling the "Throw" being accessed from the attached
From the component, you have access to all the public variables. These variables will allow anyone to make a quick change without affecting the base values on the component.
Within these variables, we can make changes that will affect the visual aspects like the mesh, mesh colour, size, and particles; the physics such as the throw velocity, gravity scaling and ground friction; and others which include, the interpolation speed, and how long the teleport will remain active.
Accessible variables within the component
Throwing and Teleporting!
When the "Throw" event is called, a few things will happen.
1) Since we're gonna be sending the player to a thrown object, I check to see if a teleporter is currently spawned. If the "teleporter object" is valid, then teleport! If its not valid, spawn one.
2) When the teleport object returns invalid, and one is spawned, I call a custom function that will set all the instanced variables to the spawned projectile (teleporter).
3) Once the variables for the teleporter have been set, I start the "ActiveTimer" which will initiate the countdown till the teleporter is destroyed. This is done by using a Timer function on loop, and deducting from the "TeleportActiveTime" value.
4) Now, if we call the "Throw" event the teleport object will return valid! Once the object is valid, and before the teleport is initiated, I do a distance check. If the object is close enough and there's no obstruction between the player and the object (like a wall), the player will simply interpolate to the object rather than instantly snap to the location. This drastically reduced how jarring it was, and created a smoother transition.
Check it out!
Check out the component script here: