[fixed] Attached Keg collision issus #2218
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Status
Description
Fixes #2214
First I tried setting
this.getShape().getConsts().collideWhenAttached = true;
tofalse
but then nothing would collide with attached Keg anymore. So I usedIf Keg is attached, only blobs that are moving and that have tag "projectile hits keg" can collide with Keg.
If Keg is not attached, then other blobs can collide with Keg as usual.
Boulder, Arrow, Ballista Bolt and catapult Rocks are given the new tag "projectile hits keg".
Other blobs that don't have this tag will not collide with an attached Keg.
So bucket or Saw thrown at Keg (which is loaded in a Catapult) will not collide with it anymore.
I considered using existing tag
"projectile"
but Rock and Boulder don't have this and blobs with that tag will set off mines so I couldn't just give Rock and Boulder that tag. So although I hate to do it I had to introduce the new tag "projectile hits keg".I want only blobs to collide with an attached Keg that can actually hit it and therefore detach it.
Let me know if there are better approaches.
Tested in offline and online, works as envisioned.
For testing steps, see the linked issue above.