Player not moving after changing scene from main menu to actual game play

Hello, I’m encountering an issue with a game I’m developing with a team of people. I’m a beginner to all of this and to play canvas so I’m having a hard time figuring out the issue. When I launch the game from the home menu or main menu and click on “Play”, it changes scenes to the actual game proper, however, I can’t move the player even though it has 3rd person movement controls. An error message appears and says “Cannot read properties of undefined (reading ‘eulers’)”.

Here is the launch link: PlayCanvas | HTML5 Game Engine
Here is the link to the editor: PlayCanvas | HTML5 Game Engine

Sorry if it’s unorganized and confusing, I’m just a beginner and still learning how to use playcanvas. I hope you can help me with this issue. Thank you!

Welcome to PlayCanvas!

If you click the link in the console where the error occurred, it will take you to the location of the error. In your case it looks like this.cameraScript does not exist when this script is called, so it can’t read eulers from undefined, as the error says.

Looks like your camera doesn’t have such script cameraMovement, but it has changeSceneClick. Which is from another scene? I assume from the initial menu scene. I usually don’t use scenes, just enable/disable parent entities, but @Albertos or @yaustar know how to switch scenes better than me, so they can advice.

Oh it actually worked! Thank you so much! Although there’s another issue that comes up. In the camera movement script, you should be able to move the camera around by pressing the left and right arrow keys while the player is moving, but for some reason, it doesn’t work after the scene changes. How can I fix this?

Here is the code for camera movement:

var CameraMovement = pc.createScript('cameraMovement');

CameraMovement.attributes.add('mouseSpeed', { type: 'number', default: 1.4, description: 'Mouse Sensitivity' });

// Called once after all resources are loaded and before the first update
CameraMovement.prototype.initialize = function () {

    this.eulers = new pc.Vec3();
    this.touchCoords = new pc.Vec2();

    var app =;
    app.mouse.on("mousemove", this.onMouseMove, this);
    app.mouse.on("mousedown", this.onMouseDown, this);

    this.rayEnd = app.root.findByName('RaycastEndPoint');
    this.on('destroy', function() {"mousemove", this.onMouseMove, this);"mousedown", this.onMouseDown, this);
    }, this);
CameraMovement.prototype.postUpdate = function (dt) {

 var app =;

 if (app.keyboard.isPressed(pc.KEY_RIGHT)) {

        this.eulers.x += 1;


 if (app.keyboard.isPressed(pc.KEY_LEFT)) {

        this.eulers.x -= 1;



CameraMovement.prototype.onMouseMove = function (e) {
    if (pc.Mouse.isPointerLocked()) {
        this.eulers.x -= ((this.mouseSpeed * e.dx) / 60) % 360;
        this.eulers.y += ((this.mouseSpeed * e.dy) / 60) % 360;

        if (this.eulers.x < 0) this.eulers.x += 360;
        if (this.eulers.y < 0) this.eulers.y += 360;

CameraMovement.prototype.getWorldPoint = function () {
    var from = this.entity.parent.getPosition(); 
    var to = this.rayEnd.getPosition();

    var hitPoint = to;

    var app =;
    var hit =, to);
    return hit ? hit.point : to;