Forum rules - please read before posting.

Draggable sliding door collider

Hi,

I am making sliding doors in a first person game by putting a draggable component to the door and adding a track to slide it along. The sliding works great, but the player is able to walk through the closed door!? The box collider and the draggable component are both directly on the door object. Removing the draggable component stops the player from walking through the closed door. What do I need to do to stop the player from being able to walk through the (closed) door object? The door is the child object of the "Door frame" object. I am not using a rigidbody component. Both "door" and "door frame" are on the default layer. The "door frame" collider only covers the frame, not the "door" middle part.

// Magnus

Comments

  • What are your AC and Unity versions, and is the Player able to walk through only while dragging, or at all times?

    Check that the Draggable component's Ignore Player's collider? is unchecked. Assuming this is already the case, could you share screenshots showing the Inspectors of both your player, and the door (draggable + collider objects) as they appear at runtime?

  • Unity 2021.3.8f1
    AC 1.77.1

    https://imgur.com/a/Fb3Otwb

    Ignore player's collider is unchecked.

    The player can walk through both when dragging and when not dragging. However, if I remove the draggable component, the player cannot walk through. I have lots of doors like this and all of them are non-walk-through-able except when I add the draggable component, they become walk-through-able.

    At runtime, a child object "Grab point" is added to the draggable object.

  • Thanks - and those screenshots are taken at runtime?

    Can you share your Player's full Inspector? You can collapse the Player component, but I'll need to see the other components attached, as well as the layer it's on.

  • Yes, taken at runtime.

    https://imgur.com/a/YKopVOS

    Here are the player properties, current layer "Ignore raycast". I tried changing to "Default" but it didn't change anything. I don't know what it does but I tried changing the things in "Movable", e.g. "move with Rigidbody" and "Ignore collisions", but that didn't change anything either.

  • Recreated, thanks for the details.

    I'll issue a proper fix as part of the next update, but in the meantime, open up AC's DragTrack script and replace the line:

    else if (KickStarter.player && _collider.gameObject == KickStarter.player.gameObject)
    

    with:

    else if (_collider.GetComponent<Player> ())
    
  • Works like a charm!! Thanks a lot !!

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.