• NV

How to use latest Teleporter released on 3.3.7 beta?

In today's post we're gonna be looking on the teleporter smart asset released in asset store. I'll go and explain everything that you need to know in order to understand how to use it and also including a little bit of code #yescode.


So let's get started for this to work we need to import the actual teleporter , change some stuffs around for debugging and test our work.


To import the smart asset follow this steps:

  • Open Assets Library

  • Click on Smart Assets tab

  • Select Teleporters (last option in the list)

  • Click on Add to Library button




If done correctly you will be able to see the following list of objects:

Now let me explain what is what here:

Teleporter FX - is the object used for visual effects on both teleporters (Entry and Exit)

Teleporter Entry - is the object that contains the logic for teleportation

Teleporter Exit - the dummy object used as a target.


Lets dive in and see what we have on each object:

Teleporter Exit contains:

  • 2x 3d Models one used for the teleporter base and the 2nd one used for texture scrolling

  • 1x Texture Scroller node used to scroll the texture that can be found on the 2nd 3d model node in the picture.

  • Start node that is not used in this case, it only enables the 3d models and the texture script


Teleporter FX contains:

  • Start node that is not used in this case, it only enables the Animation nodes.

  • 2x Animation nodes that plays when the object is spawned.

  • Remove node used to remove the object when at least one Animation has finished to play it's animation.



Teleporter Entry contains:

  • 2x 3d Models one used for the teleporter base and the 2nd one used for texture scrolling.

  • 1x Texture Scroller node used to scroll the texture that can be found on the 2nd 3d model node in the picture.

  • Start node that is not used in this case, it only enables the 3d models and the texture script.

  • 1x If collide set to output the value when a object from the "Character" group enter it's radius.

  • 1x Custom teleporter script, the big elephant in the room... the code that "teleports" the trigger object to a specific position with multiple options to use.


Teleporter script attributes:

Name: - The name of the node


Delete Input Entity: - A Boolean value set to true or false that can be used to delete the object that enters the teleporter or not.


Single Use: - A Boolean value that is used to limit the teleporter to a single use or to be used for multiple times. Note: here the teleporter has a "Activated" output so you can add a "Remove" node in case you want to remove it in a single use scenario.


Search Radius: - A number input used to search the for the "Exit Asset". This is something that you need to keep track of in order to create expected behavior in your game. There are multiple issues that can occur this value is one those.


Exit Offset: - A vector 3 input used to offset the character's position after he got teleported to "Teleporter Exit" object position if it is in radius.


Exit Asset: - The asset used by the Teleporter script to spawn a new character to it's position.


Entry FX Asset: - Object that is spawned on "Teleporter Entry" object when the character was teleported or was deleted.


Exit FX Asset: - Object that is spawned on Teleporter Exit after the player was spawned on it's position if this object is in range of "Teleporter Entry" object.



Proper setup and debug options:

If you are going to use this smart asset you need to check the following rules in order to trigger the teleportation effect:

  1. Make sure your character object or whatever object is used to be teleported is set to Characters collision group. To do this just select the object in library (left most position) and change the "Collision Group" attribute from the top right position from None to Character.

  2. Check the Teleporter Exit to be in range of Teleporter Entry radios. Now this is the tricky one and the most common issue that can happen so let's fix it.


How can I add a visual indicator in preview to know if I am placing the object in the right radius of the teleporter?


  • Open the Teleporter Entry object and duplicate a 3D Model node.

  • Rename it to "Marker", remove the texture, edit the mesh and set it to "Cylinder", change your scale to be [x:0 , y:0.1, z:0].

  • Double click on Teleporter node and replace the function init() with the following code:



function init() {
	deleteInputEnt = this.attribute('Delete Input Entity');
	singleUse = this.attribute('Single Use');
	searchRadius = this.attribute('Search Radius');
	exitOffset = this.attribute('Exit Offset');
	exitAsset = this.attribute('Exit Asset');
	exitFXAsset = this.attribute('Exit FX Asset');
	entryFXAsset = this.attribute('Entry FX Asset');
 
	let marker = this.entity().component('Marker');
	let offset = 2;
	marker.setScale(searchRadius+offset, 0.2, searchRadius+offset);
}

Now let me explain how this works. Let's assume that you set the search radius to 5 on the Teleporter script and you place the Teleporter Exit "near" the object but you don't know if is in range or not.

The green circle is used to show the actual range that the Teleporter script uses, if the Teleporter Exit is in that range the character will teleport otherwise it will get deleted as can be seen above.


Change the radius to 11 so that the character will be in range and enjoy your first teleporter script made inside Buildbox game engine.


This is the basic example on how you can use this teleporter in your game, below you can find some extra gifs on how this can be used.




Extra examples:



92 views0 comments

Recent Posts

See All