The problem is on line 5. For some reason when I set the position to -3.5, it goes to 3.5. I don’t know why this happens, but I really need this to work. Thanks for any help!
Here is the project. PlayCanvas 3D HTML5 Game Engine
Here is a quick rundown of the project:
You start on a platform with a 1 below your character, if you go towards the 2 it will disable the current platform and enable another one with a 2 on the platform.
When the platforms enable and disable the character should teleport to one side, -3.5,0.5,0.
(I put a red cube at (3.5,0.5,0) and a blue one at (-3.5,0.5,0) for reference).
The idea is to make an illusion that you are going around a planet.
I know that’s a lot of info so if I can help break anything down I will be happy to help
Thanks!
So it won’t move with setPosition function. You will have teleport it using rigidbody Teleport function in order to move the player.
Simply update setPosition line with this.entity.rigidbody.teleport(yourposition) and it will work.
Here is the updated code:
@yaustar Thanks, it made me think about the size of the player. I thought it wouldn’t teleport into the collision because it teleported to -3.5 but the wall was at 4. I just had to change the collision to 5.