Thirdperson controller using virtualstick

I am trying to control third person using the virtual stick.
could you please help me work this.

Project link:

thank you in advance

Hi @Tom_Tom and welcome,

What issues are you experiencing?

1 Like

@Leonidas Thank you very much fir the reply.
I am having troble on playing animation.

I want to move third person and its animation
Jog forward, Jog Backward play on moving virtualstick.

So, animations seems to be working fine when using keyboard WASD. All animation handling is done in the playerAnimationHandler script. The following method is responsible for the animation state logic:

PlayerAnimationHandler.prototype.checkButtons = function () {
    var app =;
    var w = app.keyboard.isPressed(pc.KEY_W);
    var a = app.keyboard.isPressed(pc.KEY_A);
    var s = app.keyboard.isPressed(pc.KEY_S);
    var d = app.keyboard.isPressed(pc.KEY_D);

    if (w && !s) {
        if (a && !d) {
            this.direction = 'Run Forward Left';
        } else if (d && !a) {
            this.direction = 'Run Forward Right';
        } else {
            this.direction = 'Run Forward';
    } else if (s && !w) {
        if (a && !d) {
            this.direction = 'Run Backward Left';
        } else if (d && !a) {
            this.direction = 'Run Backward Right';
        } else {
            this.direction = 'Run Backward';
    } else if (a && !d) {
        this.direction = 'Run Left';
    } else if (d && !a) {
        this.direction = 'Run Right';
    } else {
        this.direction = 'Idle';

You will have to communicate your virtual joystic state (forward/backward/side) to this script and in the same manner run the animation logic. You can use Playcanvas events to easily communicate between scripts.

You can take a look at the First Person controller on how it uses the input from different sources (keyboard/mouse/touch/gamepad) to drive the same controller once:

1 Like

Thank you very much I managed to solve the problem.

1 Like