Walking in a third person game

Everything is fine but the map moves with the character so you cant go to the end of the map why is that?

Hi @Gabriel_Dobrzynski,

Most likely you have parts of your level added as children to your player entity maybe? Try sharing your project structure and entity hierarchy to take a look at.

https://playcanvas.com/editor/scene/1063032 here is a link

The issue in this case is in your code, this bit:

    if (x !== 0 || z !== 0) {
        var pos = new pc.Vec3(x * dt, 0, z * dt);
        pos.normalize().scale(this.speed);
        pos.add(this.entity.getPosition());
    }

You are calculating a vector, but you aren’t really using it anywhere to apply a force/impulse on the player body.

Check the following example project how it does this:

https://playcanvas.com/editor/project/705595

    if (x !== 0 || z !== 0) {
        var pos = new pc.Vec3(x * dt, 0, z * dt);
        pos.normalize().scale(this.speed);
        pos.add(this.entity.getPosition());

        var targetY = this.cameraScript.eulers.x + 180;
        var rot = new pc.Vec3(0, targetY, 0);

        this.entity.rigidbody.teleport(pos, rot);
    }

Thanks @Leonidas