Pages

domingo, 23 de abril de 2017

BP Compendium 3: Teleport

Teleport


Moves an actor to the specified location. If there is an obstacle in the location, the actor is moved to a nearby place where there is no collision.

Input

  • Dest Location: Destination location.
  • Dest Rotation: Rotation applied to the actor.


Output

  • Return Value: Boolean value. If "false" indicates that the actor could not be moved.


Example Usage: 

In a game, the player collects coins. The image below shows the "ActorBeginOverlap" event of the blueprint that represents the coins. When a coin is collected the "AddCoinPoints" function of the player is called to register the points and after that the coin is teleported to another location in the playing area. The playing area has several obstacles, but the "Teleport" function will place the coin in a free place.

Click to enlarge

The playing area is defined by the values of X > -1600 and X < 1100, Y > -1800 and Y < 1800. The "Random Float in Range" function returns a random float value that is between the "Min" And "Max" that are passed as parameter.

The "Make Vector" creates a vector using the random values that were found for X and Y. This vector is used as the destination in the "Teleport" function.