Two times the damage

Just if anyone as uncounter the same problem, if not, I’ll rebuild new weapon and projectile to track my issue, no need to answer here.

Adding the health display, I discover that the archer gives my player the damage two times.
My projectile has 4 damage, and the display show -4 then again -4 (not -8 once).

M. D.

I’m assuming you’re not getting double damage with the weapons.

Paste in your Projectile.cs and we’ll take a look.

Hi, I go on with the course before coming back to this bug.
I found out that this happens only when Homing is on.
The collider of the arrow was not destroy as it enters the player capsule one, because I wanted the arrow to be able to passthrough the first target and continue its journey (in a straigh line) if a certain attribute was “on”).
For some reason, it registers the collision twice.

So, if I want the arrow to continue its journey, I shall disable the collider on the arrow OnTriggerEnter maybe, and enable it again OnTriggerExit after removing the possibillity to trigger the last target.

M. D.

Try this:
Add a global variable

private Health lastHit;

In OnTriggerEnter, after getting the Health component on the other collider and ensuring that it is not null…

if(health == lastHit) return;

Thank you much.

Privacy & Terms