Interact like demo "Gates"

sneekyo

Member
Hi,
How can I set up an object to animate when the player is near like the Gates in the Demo Scene?

So far I've got an object set up with animator and bool to open and close, I have a intractable with ID and a animated intractable with the bool, then on nolan I've set up a new interaction, but I can't figure out the settings to get it to work properly with the "trigger" function.
 
So I guess you want the interaction to happen automatically (i.e. no button press), right? You'll need to set up a trigger collider on the door object to cover the area that you want the trigger to occur, then use the "Trigger" object detection mode for the interact ability. Also make sure that the interact ability's "Detect Layers" array contains the layer that the door is in too (and that these layers are set up to detect each other in your project's physics layer collision matrix!).

It may be worth noting that the gates in the demo scene don't actually use the Interact ability - they're just simple custom components that start the open/close animation when the character enters their trigger collider.
 
For sure, I wanted to ability to make it more complex than the gates in the demo, but the same concept using interact. I have it already set up as you mentioned the only part I didn't know / have never done before is the layer collision matrix, how does that work Andrew?

Thank you!
 
In Project Settings/Physics, you'll see the collision matrix at the bottom, something like this:

1602677254667.png

Each checkbox defines whether the two layers it aligns with will collide or not. E.g. the top-left checkbox determines whether the "Default" layer and "Character" layer will collide with one another.
 
It doesn't look like your gate object has a trigger collider? E.g. the gates in the demo scene have a trigger box collider that extends far down the hallway:

1602846999815.png
 
Hi Andrew,
It does have a large box collider with is trigger set on it, I used "gate" as a reference. But doesn't seem to be detecting the character entering it.
 
An automatic start and stop type will just stop the ability right away. In cases like this it's always the easiest to debug what is happening by placing a breakpoint within Ability.AbilityStarted and see what the ability isn't doing what you'd expect. AbilityAbilityStopped will be called when the ability is stopped.
 
Top