[SOLVED] Calculating the speed of an object without RigidBody or check if position is changed

I need to find out if the object is moving. it doesn’t have a Rigidbody, I use setPosition(xyz); I get xyz from the server. Thanks

    if (this.initialized)
        this.oldpos = this.players[data.id].entity.getPosition();
        if(this.oldpos.x > data.x || this.oldpos.x < 0){
            this.players[data.id].entity.anim.setFloat('Distance', true);
        if(this.oldpos.x == data.x){
            this.players[data.id].entity.anim.setFloat('Distance', false);

Thanks. It works

1 Like