BoxCollider, cc.Prefab, Tag question

Hi,

I created a Prefab with a BoxCollider and Tag = 1, I also set the Prefab under the group to zombie and then went to Project - > Project Settings, and checked the Group Collide Map for the zombie to collide with player. Now, I’m trying for the player to collider / recognize as per Tag = 1, and it’s not detecting and reducing player’s health, please see below:

collideleftzombiemoveright:cc.Prefab
var boxcollider = this.collideleftzombiemoveright.getComponent(cc.BoxCollider);
this.node.color = cc.Color.RED;
this.touchingNumber ++;
if(boxcollider.tag === 1){
this.healthbarscore.progress -= 0.10}

Any help will be appreciated it…Thanks and God Bless…

Sincerely,

Sunday

Can you upload a project with this problem? It can help to find your problem. : )

Hi,
testcollider:{
default: null,
type: cc.Prefab},

onCollisionEnter: function (other,self) {
this.node.color = cc.Color.RED;
this.touchingNumber ++;
var world = self.world;
var aabb = world.aabb;
var preAabb = world.preAabb;
var t = world.transform;

// for circle collider
// var r = world.radius;
// var p = world.position;

// for box collider and polygon collider
 var ps = world.points;
 var playerboundingbox = this.node.getBoundingBox();
 //if(cc.Intersection.pointInPolygon(touchLoc, this.polygonCollider.world.points))
  //if(cc.Intersection.rectRect(this.footballbulletreplenishboundingbox,this.node.boxCollider.world.points))
**if(cc.Intersection.rectRect(this.testcollider,this.playerboundingbox));**     
//if(cc.rectIntersectsRect(this.playerboundingbox,this.testcollider));

  {this.healthbarscore.progress -= 0.10}},
  {
    },

As you can see, I’ve tried different methods, but still nothing…Right now, I’m focusing on getting the Player to Collide with the Prefab using the get.BoundingBox method, but nothing…Any help will be greatly appreciated it…Thanks for taking the time to read and God Bless…

Sincerely,

Sunday