While working on one of my games for Live Pixel Games I needed to create a custom node that would teleport the object to a specfic location. Below is a picture and the script you can use or download to use this in your game.
function init() { } function update(dt) { } function signal(name, value) { if (value) { let assetName = this.attribute('Asset Name'); let ent = this.entity(); if (ent == null) { error('Asset "' + assetName + '" does not exist'); } let pos = this.attribute('Teleport Position'); ent.setPosition(pos.x, pos.y, pos.z); } }
Make sure to add the custom attributes
If your object collides with the object of your choice it will teleport to the cordinates you have typed down in "Teleport Position".