Skip to content
James Liu edited this page Jun 6, 2015 · 1 revision

Danmaku Colliders and their interface equivalent IDanmakuCollider are the only ways to get Unity 2D colliders to interact with fired bullets.

To make a script that is able to use an attached 2D collider to interact with bullets, either derive from the abstract DanmakuCollider class (which is a MonoBehaviour) or have your MonoBehaviour implement the IDanmakuCollider interface.

DanmakuCollider (the abstact class) derived classes also have a useful feature of filtering bullets. In the Inspector, there is a field for a Tag Filter. Enter any regular expression, and only the bullets with tags that match that will interact with the Danmaku Collider script.

#Built in Colliders

DanmakU comes packaged with a number of useful, pre-created Danmaku Collider implementations:

Deactivation Collider

This Danmaku Collider automatically and instantly deletes all matched bullets that come into contact with the collider. Generally good for "bullet clear areas".

Acceleration Collider

This Danmaku Collider speeds up or slows down all matching bullets so long as they are in contact with the collider. The bullets will maintain their speed even on exit.

Constant Force Collider

This Danmaku Collider pushes all matching bullets in a certain direction so long as they are in contact with the collider. These bullets will return to normal speeds/movement upon exit, unlike the Acceleration Collider.

Redirection Collider

This Danmaku Collider will change the direction of motion of matched bullets instantly on contact. The target angle can be configured with a number of options.

Reflection Collider

This Danmaku Collider acts like the Redirection Collider in that it changes the direction of motion of matched bullets, but it is special in that it uses standard reflection. (i.e. angle in = angle out). Think of how a mirror reflects light, except with bullets.