Forum rules - please read before posting.

Doors physics

Doors are my nightmare, but apparently I'm not alone!

I have a very particular issue, though, doors in my game are physics-based, and sometimes I want to stop the door from opening fully: either when the player is in the way, or when an object is in the way that the player has to move (like a heavy box).

Currently I have my doors on a basic switch system: the player simply left-clicks on them to open or close them, which takes place through a moveable -> set track position action, after checking its current state (open/closed) through a boolean variable.

Essentially I'd need a way to say "hey, door, you've hit something solid. Stop trying to open or close." Currently the action will attempt to complete no matter what, and produces a jittering of the door as it repeatedly slams into the blocking object or player. Does anyone have any advice as to how I could resolve this?

Thanks!

Comments

  • edited September 2015
    It may be that some kind of "Stop moving when hit collider" option in the Action is needed.

    The problem would be figuring out the best way to define what Collider type should stop the Draggable from moving.  It should be simple and intuitive, but not restrictive.  I'm open to suggestions or thoughts on this.
  • If you did add in that option, that would be excellent!

    Perhaps just a tag would work? Anything tagged "collider" or whatever (something definable) interrupts a moveable's movement. Or an option to either use tags, or all colliders in the scene.

    I suppose the ideal solution would be something similar to the particle system's collision parameters: bounce percentage, "life" (or continued force in this case) reduction percentage, etc. I'm not sure how you manage the continued force from AC's side, but if it's easy enough to implement, it would be rad to be able to customise the collision to this extent. If not, though, then a simple "if it collides with these tagged objects, cease all movement (and maybe drop it from the player's hand, if it's under player control)".
  • AC relies on Unity's own Physics system, so the collision itself is
    going to occur/behave only according to that.  This means you can still
    use e.g. Physics Materials to get the "bounce" effect right, and tweak
    Unity's Physics settings so that different layers ignore each other.

    In
    other words: AC won't interrupt an object's movement in the physical
    sense.  But what we can do is say "if this type of collision has
    occured, then stop trying to move it along the track".

  • Ah, okay, that would actually be perfect!
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.