

const { ccclass, property } = cc._decorator;

@ccclass
export default class BacksideFragment extends cc.Component {

    @property(cc.Node)
    private frontSideNode: cc.Node = null;
    
    private _offsetPos: cc.Vec3 = null;

    protected onLoad(): void {
        this._offsetPos = this.node.position.clone().sub(this.frontSideNode.position);
    }

    protected update(dt: number): void {
        this.node.angle = this.frontSideNode.angle;
        this.node.position = this.frontSideNode.position.clone().add(this._offsetPos);
    }

}
