Two colliders on a target?

JohnG

Member
Hi,

I have a simple object with the following hierarchy:

cube (rigidbody, physical box collider)
|______gameobject (box collider with is larger than cube. Collider is Trigger. simple ontriggerenter script)


Questions:

  1. am trying to detect hit from assault rifle (hitscan) on the gameobject so that I can activate something else on the cube. I am struggling to get this to work, is there a solution?
  2. I through maybe the hitscan trigger interaction would be the answer, however when I set this to collide, it physically collides and the ontriggerenter doesn't fire. Is this how its supposed to work?
 
I am looking for a impact register on the first trigger collider (no physical interaction, just code interaction), and a physical interaction on the inner regular collider.

The main issue I am having now is that the impact on the outer collider (trigger) not behaving like a trigger collider, it is actually moving the object on impact. I have tried numerous settings on the impact setting of the shootable weapon scripts, e.g.

changing impact layers:
inner object has layer "enemy", outer object has layer "test". I have tried all combinations of including them, excluding them, etc.


Changing hitscan trigger interaction:

On "collide" it moves the object and registers on the OnImpact event.
On "ignore", it ignores everything.
 
In that case I think that your best bet is to subclass the Projectile component and add your own logic. OnCollision gets called when the object impact occurs.
 
Top