xx 1 年之前
父节点
当前提交
c8442f30a5
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      assets/script/game/car.ts

+ 4 - 0
assets/script/game/car.ts

@@ -412,6 +412,10 @@ export class car extends Component {
                 }
             }
 
+            if(x<left||x>right){
+                x = this.node.position.x
+            }
+
             let rect = new Rect(x-size.width*0.5,y-size.height*0.5,size.width,size.height)
             // let rect = this.node.getComponent(UITransform).getBoundingBox()
             let list = this.game_manager.carCollider(rect)