fix(physics): 启用物理调试绘制并设置英雄碰撞组
启用AABB和质心的物理调试绘制标志,并在HeroViewComp中设置碰撞器组为英雄组
This commit is contained in:
@@ -12,9 +12,9 @@ const { ccclass, property } = _decorator;
|
||||
@ccclass('Main')
|
||||
export class Main extends Root {
|
||||
start() {
|
||||
// PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb
|
||||
PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb
|
||||
// |EPhysics2DDrawFlags.Pair
|
||||
// |EPhysics2DDrawFlags.CenterOfMass
|
||||
|EPhysics2DDrawFlags.CenterOfMass
|
||||
// |EPhysics2DDrawFlags.Joint
|
||||
// |EPhysics2DDrawFlags.Shape;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,11 @@ export class HeroViewComp extends CCComp {
|
||||
this.on(GameEvent.FightEnd,this.do_fight_end,this)
|
||||
const collider = this.node.getComponent(BoxCollider2D);
|
||||
this.scheduleOnce(()=>{
|
||||
if (collider) collider.enabled = true; // 先禁
|
||||
if (collider) {
|
||||
collider.enabled = true; // 先禁
|
||||
collider.group = this.box_group; // 设置为英雄组
|
||||
}
|
||||
|
||||
},0.1)
|
||||
// let anm = this.node.getChildByName("anm")
|
||||
// anm.setScale(anm.scale.x*0.8,anm.scale.y*0.8);
|
||||
|
||||
Reference in New Issue
Block a user