Yes, the problem is probably because the parentheses before and after the script name. Can you confirm that @Gabriel_Dobrzynski? Does the script works as expected after your fix?
i expect to teleport but instead, I run into it
Im So CONFUSED!
I’m unable the check your project at this moment so can you check and confirm this please? I assume the script is on the rectangle?
yes
they have it all
does the rectangle have to be a wall or could it peek from the ground
IDK heres pictures.
Looks like your curly brackets are in the wrong places. Does this help?
Teleport.prototype.initialize = function () {
this.entity.collision.on('collisionstart', this.onCollisionStart, this);
this.teleportPoint = this.app.root.findByName('TeleportPoint');
};
I don’t see a script on your rectangle and the rigidbody component is disabled.
I didn’t mean replace this whole script just to fix the initialize function.
But here is the whole script for you to replace
var Teleport = pc.createScript('teleport');
// initialize code called once per entity
Teleport.prototype.initialize = function () {
this.entity.collision.on('collisionstart', this.onCollisionStart, this);
this.teleportPoint = this.app.root.findByName('TeleportPoint');
};
Teleport.prototype.onCollisionStart = function (result) {
if (result.other.rigidbody) {
result.other.rigidbody.teleport(this.teleportPoint.getPosition());
}
};
Im back, this is weird It should let you teleport, have you put the script on the rectangle? Also, if you have then can you send a link?
Thank you
(should i ignore this mess when i go into it?)
Uh, this could not affect the game or affect the game badly. It’s just better to try and fix it because then the game might not work as expected.
how do i fix it?
It looks like there is no collision component anymore. Try to debug by yourself first and stop posting short messages.