在摄像机上绑定了下面代码,可以实现触摸移动时摄像机跟着动,但我想限制摄像头只能在场景里的一个作为地图的精灵图片的范围里动的话,请问该怎么弄呢?
switch (event.type) {
case 'touch-start':
this.postion = this.node.getPosition();
break;
case 'touch-move':
this.postion = new Vec3(this.node.getPosition().x + event.getDelta().x, this.node.getPosition().y + event.getDelta().y, 0);
this.node.setPosition(this.postion.x, this.postion.y, this.postion.z);
break;
case 'touch-end':
case 'touch-cancel':
this.node.setPosition(this.postion.x, this.postion.y, this.postion.z);
break;
}