[SOLVED] Out and Back

Ok thanks I will let you know if it does not work out.

1 Like
var Outandback = pc.createScript('outandback');

// initialize code called once per entity
Outandback.prototype.initialize = function() {
};

// update code called every frame
Outandback.prototype.update = function(dt) {
    if(this.app.mouse.isPressed(pc.MOUSEBUTTON_LEFT)){
        this.entity.translateLocal(0,0,-2);
    }

    else{
        if(this.app.mouse.wasReleased(pc.MOUSEBUTTON_LEFT)){
//Your Positions Go Where The Question Marks Are
            this.entity.setLocalPosition(?,?,?);
        }
    }
};

This is the script that I coded to make this work using translate local
Rigidbody: kinematic
Collision: none