#Set Collision Filter bugged?

1 messages · Page 1 of 1 (latest)

fallen axle
#

Hi!

I've been struggling with this issue for a few hours. For my combat system, I have a pool of entities that gets instantiated from a prefab. When a combat attack is triggered by a character, it pulls one of these combat entities out of the pool and sets all of the combat values ie: lifetime, range, speed (if projectile) AND the relevant collision filter. This combat entity is kinematic, so I'm using a triggerevent to watch if it collides with an enemy. The idea is to change the collision filters of the collider at assignment, depending on if it's an attack triggered by an enemy, or by the player character. After the combat entities lifetime has expired, I put it back in the pool, and reset it's collision filter to collide with nothing. The process repeats: attack is triggered -> entity is pulled out of pool -> collision filter is set -> wait for collision events -> lifetime expires -> reset collision filter and return to pool.

if I reset the collision filter at the end of the lifetime, the trigger events don't fire. Or at least they don't fire consistently. They'll still fire every once and a while. If I comment that out, I get the tirgger events every time. I just spent two hours rewriting my systems to ensure update order and ECB playback lines up as expected, and it's still an issue. The collider on the prefab is set to "force unique". Anyone have any ideas?

#

here's the combat systems

#

and the prefab collider settings

fresh canopy
#

Collider is a blob. Even if you force unique, prefab still has same as any entities instantiated with it.

fallen axle
#

so is there a way to change the collision filter on one specific entity?

#

even if they're all instantiated from a prefab?

fresh canopy
#

Filter belongs to blob. Blob is referenced by all entities.

#

So unless you create blob for each entity, no

#

And managing blobs for each entity is another set of headache

fallen axle
#

ok so separate prefab for enemy & player collider huh

fresh canopy
#

yeah, you can swap collider alltogether

fallen axle
#

how would I swap the collider?

#

other than baking two prefabs with different colliders... or is that what you mean?

#

can you programmatically add colliders to the blob?

fresh canopy
fresh canopy
fallen axle
#

I was just going to bake a few physics materials and set them that way

fresh canopy
#

And then just set value by reading from one of those entities

#

Or you can bake cloned collider in other field

#

That's even easier

fresh canopy