[]hitTestPoint对象父容器rotation旋转之后检测不了碰撞
hitTestPoint对象父容器rotation旋转之后检测不了碰撞
附上代码
附上代码
class FishPonds extends Laya.Sprite {
public are: Laya.Rectangle = new Laya.Rectangle(0, 0, 60, 30);
constructor() {
super();
var _fish: Laya.Sprite = new Laya.Sprite()
_fish.graphics.drawRect(this.are.x, this.are.y, this.are.width, this.are.height, "#00ff00");
_fish.x = 300
_fish.y = 200
this.addChild(_fish);
Laya.timer.loop(100, this, function () {
console.log(_fish.x, _fish.y, _fish.width, _fish.height, _fish.rotation);
if (_fish.hitTestPoint(_fish.x, _fish.y)) {
console.log("hittttttt");
}
});
}
}
//程序入口
Laya.init(600, 400);
this.onLoaded()
function onLoaded(): void {
//实例UI界面
var testUI: FishPonds = new FishPonds();
Laya.stage.addChild(testUI);
Laya.timer.loop(1000, this, function () {
testUI.rotation = 360
console.log("rotation!" + testUI.rotation);
});
}
没有找到相关结果
已邀请:
要回复问题请先登录
2 个回复
qian
赞同来自:
qian
赞同来自: