Hi everyone,
I am trying to teleport the player to the position of another entity, but i cannot find the way to make it work
I am using a simple code:
var ChangeScene = pc.createScript('changeScene');
ChangeScene.attributes.add('sceneName', { type: 'string' });
ChangeScene.attributes.add("link1", { type: "string", title: "onclick Link" });
//
ChangeScene.attributes.add("cubemap", { type: "asset", title: "cubemap" });
ChangeScene.attributes.add('teleport', { type: 'entity' });
//
// initialize code called once per entity
ChangeScene.prototype.initialize = function () {
this.entity.element.on('click', function () {
this.loadMap();
}, this);
};
ChangeScene.prototype.loadMap = function () {
loadAtrezzo = this.app.root.findByTag('rig');
loadAtrezzo.forEach(function (node) {
node.rigidbody.teleport(this.teleport.rigidbody.position, pc.Vec3.ZERO);
});
};
also tried using translate but nothing. The most mysterious thing is that it started giving me this error:
But that entity (teleport) is assigned:
So i do not know how to proceed