playMaker

Author Topic: How do I handle skill damage collision for stationary enemies?  (Read 6712 times)

Disastercake

  • Full Member
  • ***
  • Posts: 101
  • www.disastercake.com
    • Disastercake
I'm having an issue where if an enemy is close to the player, it will not register getting hit by a projectile.  I'm not sure how else to handle this, since it appears the fireball is going directly through the enemy, and there is no reason for it not to trigger since the collision trigger IS working properly.

Any thoughts?

« Last Edit: May 30, 2012, 11:12:50 AM by Disastercake »
Soul Saga - Anime themed adventure RPG by Disastercake

http://www.disastercake.com

Disastercake

  • Full Member
  • ***
  • Posts: 101
  • www.disastercake.com
    • Disastercake
After playing with this I realized what the issue is:

Trigger events do not check to see if the colliders are overlapping,they simply check if one unit enters into it.  This means that if the unit is not moving, but the projectile is, then the trigger will NOT go off.

For the spells in a game like Soul Saga, what I need is an action that checks if there are ANY colliders intersecting with a specific collider every frame, no matter whether it was spawned on them, someone entered, someone stood still and got entered, etc. (an optional filter tag option would also be nice with this to tag hitbox colliders)

For example, if the enemy is standing still ,the fireball should still hit them.  Or, maybe I have a spell with a fireball that moves at first , then sits at a location until someone collides with it (like a bomb).  Or Maybe a fireball will spawn on top of an enemy (because it's too close).

There must be a simple way to achieve this, but with the limited knowledge I have this seems like it'd be a very complicated web of collision detection.

Does anyone know how to achieve the results I need?
« Last Edit: May 28, 2012, 10:08:30 PM by Disastercake »
Soul Saga - Anime themed adventure RPG by Disastercake

http://www.disastercake.com

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Have you tried checking TRIGGER STAY as well? This should catch the case where an object is spawned inside a trigger...

Disastercake

  • Full Member
  • ***
  • Posts: 101
  • www.disastercake.com
    • Disastercake
Yes I have tried that.  Trigger stay will not trigger it as well.  I had the same thought that it would pick it up, but it didn't work that way.

For Trigger stay to happen, doesn't trigger enter have to have happened first?  Since trigger enter is never happening, trigger stay can never fire off.  This is actually mentioned in one of the Playmaker tutorials titled "Triggers".
« Last Edit: May 28, 2012, 10:56:33 PM by Disastercake »
Soul Saga - Anime themed adventure RPG by Disastercake

http://www.disastercake.com

Disastercake

  • Full Member
  • ***
  • Posts: 101
  • www.disastercake.com
    • Disastercake
Another reason I know this is true is because if I create the projectile inside the enemy as it's moving, it will trigger immediately, while if I create it inside him while he's not moving, it will not go off.
Soul Saga - Anime themed adventure RPG by Disastercake

http://www.disastercake.com

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Hi,

 Have you tried changing the settings of the rigidBody, you can choose between discrete | continous | continous dynamic it might affect your issue.

I would instead of letting the projectile find out if it is inside, have a collider watching for the enemy, and if the enemy has collided with it ( that is it's close), then you fire the projectile another way, for example making it explode simply ( the end result), else you do fire it because you know the enemy is far enough to have all the triggers fire properly.


Bye,

 Jean

Disastercake

  • Full Member
  • ***
  • Posts: 101
  • www.disastercake.com
    • Disastercake
I will try using that now.

Would you mind explaining to me which each of the settings means?  I'm having issues understanding what this documentation means:

http://unity3d.com/support/documentation/Components/class-Rigidbody.html
Soul Saga - Anime themed adventure RPG by Disastercake

http://www.disastercake.com

Disastercake

  • Full Member
  • ***
  • Posts: 101
  • www.disastercake.com
    • Disastercake
I've gotten no effect change using any of the settings changed on the unit's hit box.

I would instead of letting the projectile find out if it is inside, have a collider watching for the enemy, and if the enemy has collided with it ( that is it's close), then you fire the projectile another way, for example making it explode simply ( the end result), else you do fire it because you know the enemy is far enough to have all the triggers fire properly.

Actually what's happening here isn't that the enemy is too close (I initially thought that), but whats happening is if the enemy isn't MOVING then the trigger will never go off.  So if the enemy is standing still, the trigger will never occur even if the fireball flays right through them.
« Last Edit: May 29, 2012, 06:26:13 PM by Disastercake »
Soul Saga - Anime themed adventure RPG by Disastercake

http://www.disastercake.com

Disastercake

  • Full Member
  • ***
  • Posts: 101
  • www.disastercake.com
    • Disastercake
Re: How do I handle skill damage collision for stationary enemies?
« Reply #8 on: May 30, 2012, 05:10:09 PM »
I've been also having this conversation on the Unity forums (http://forum.unity3d.com/threads/137869-Fireball-projectile-not-triggering-unless-enemy-is-moving.).

They are recommending using "OverlapSphere". Function

I've been working on a custom playmaker action to see if I can get this to work, but it's taking a while since I want to make it dynamic and tell if it's collided with multiple enemies (for AOE skills).

I just want to check one more time to see if Alex doesn't know if there's a native way to accomplish this in playmaker before I make this massive custom action that combines several other actions into one.
« Last Edit: May 30, 2012, 05:15:07 PM by Disastercake »
Soul Saga - Anime themed adventure RPG by Disastercake

http://www.disastercake.com

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: How do I handle skill damage collision for stationary enemies?
« Reply #9 on: May 31, 2012, 03:22:10 AM »
I would have expected trigger stay to handle this situation... I'll check your link to the unity forum thread...

justifun

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 280
Re: How do I handle skill damage collision for stationary enemies?
« Reply #10 on: June 01, 2012, 07:23:46 PM »
The other option is to use the get distance action and skip using collisions all together for certain circumstances.

eg: if the player plants a AOE or a bomb or something, when it detonates, it broadcasts an event called "explosion damage"

on your player or enemies, there would be a global transition state(explosion damage)that checks its own distance to the bomb in question, and if its within the blast area, then it switches to its take damage state.


Disastercake

  • Full Member
  • ***
  • Posts: 101
  • www.disastercake.com
    • Disastercake
Re: How do I handle skill damage collision for stationary enemies?
« Reply #11 on: June 02, 2012, 01:38:26 PM »
@Justinfun: That will not get the bounding box collision ,only the center point position of the unit.  That would produce undesirable results.


I'm now coming up with the issue that there are apparently no alternatives to the SphereOverlap method (which works perfectly).  So there's apparently no rectangle or capsule overlap, and you can't change the shape of the sphere to me an oval or anything like that.  Does anyone know any alternatives for this?
Soul Saga - Anime themed adventure RPG by Disastercake

http://www.disastercake.com