Forum rules - please read before posting.

Wall Collision Bug

Just wanted to report a bug I found with AC version 1.83.0, we are using the "Slow movement near walls?" toggle which was working but then we updated to this version and it stopped.

After some investigation, I have discovered that the code which handles the collision detection uses the "wallLayer" variable which is serialized inside of Char.cs but never actually gets set anywhere. I was able to correct this issue by changing some code inside of the UpdateWallReductionFactor() method from using the "wallLayer" variable to instead use the "WallLayerMask" property, so from this...

RaycastHit2D hit = UnityVersionHandler.Perform2DRaycast (origin, forwardVector, wallDistance, 1 << LayerMask.NameToLayer (wallLayer));

to this...

RaycastHit2D hit = UnityVersionHandler.Perform2DRaycast (origin, forwardVector, wallDistance, WallLayerMask);

Comments

  • Oops. Actually, this issue is actually a bit different.

    The wallLayer variable was deprecated in favour of the new wallLayerMask variable - see the "Upgrade note" section for v1.83:

    • Player/NPC "Wall collider layer" fields are now a LayerMask field, not a text box

    Character Inspectors have had their "Wall collision" fields changed from text fields to a new LayerMask option.

    The real issue is that Char doesn't rely on it!

    To fix, replace the above-mentioned instance of:

    1 << LayerMask.NameToLayer (wallLayer)
    

    to:

    WallLayerMask
    

    Thanks for the report!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.