Physics Interaction: Doors and Locks is a system for adding physics simulation based interactive elements to your project. It is compatible with VR as well.
Ability to check if Interaction input got used for interacting. Can be used to use same key for both Interacting and any other action (e.g. firing a gun)
Supports First person, Third person, Top Down, full VR, and probably any other type
Multiple detection methods such as tracing, mouse cursor or custom mesh collision
Mesh collision detection prioritizes grabbing Lockset over Openable. Useful for preventing accidentally grabbing door when intended to grab handle in VR
Select any actor as a key
Basic inventory system for picking up keys (not visual, just a string array)
Ability to use custom Collision Profile for Openable and Lockset meshes
Basic, modifiable sound system for playing sounds when certain events happen e.g. door opened, lock got unlocked, etc.
Save created actors as templates (prefab of multiple actors) to spawn without needing to copy paste/rebuild
Easily access events from other actors and extend functionality of system itself
—Updates:
Update 3:
Remade template system for 4.24+,
VR input for Demo character is added automatically.
Update 2:
Fixed a compatibility issue with UE4.19,
Made DemoVRCharacter compatible with Oculus Rift.
Update 1:
Added a property to Openable and Lockset for attaching actors. In Static Mesh - Show Advanced > Attached Actors,
Used map same as demo project,
Used Player Controller same as demo project.
Notice: updated Demo after this update was published. In new version of Demo, added a help menu with Controls, 2 quality presets and exit button.
—Extra Guides:
—Template First Person implementation
This guide will show how to use same Fire input to both interact and fire the gun as default in First Person Template:
[spoiler]
Add Interactor and InteractionModulePhysicsDoorsAndLocks:
Add a Custom Event node, name it Fire and replace InputAction Fire with it:
Set up event macro as usual:
Add a branch and call Fire event node like this:
When you press InputAction Fire it will fire if there are no Openable, Lockset or Key under cursor.
—Template VirtualReality implementation
This guide will show how to implement this system with UE4 default VR template:
Add components to BP_Motion Controller, attach Interactor to MotionController component
Select InteractionModulePhysicsDoorsAndLocks, in Details panel click “Show Advanced” and set Alternative Grab Method to True
In Event Graph after Event BeginPlay add these nodes to use GrabSphere for collision detection just like template’s pick up system
In Event Graph, inside Update animation of Hand comment box, make these additions to play CanGrab animation when this system’s component is overlapped by GrabSphere
Open Grab Actor function from My Blueprint > Functions > Grabbing and make additions as below to use **Interact Pressed **function of our system when there is no pick up actor detected
Open Release Actor function from My Blueprint > Functions > Grabbing and make additions as below to use **Interact Released **function of our system when Openable or a Lockset is grabbed. Otherwise call Drop on picked up actor.
Now, you can both pick up objects and grab Openable or Locksets using same input and animation system of Template VR of UE4.
—Horror Engine implementation
To implement this into the free marketplace asset called Horror Engine:
Open blueprint component PhysicsInteraction_DoorsAndLocks -> Blueprint -> Misc -> InteractorComponent, open function TraceCheck and make this addition:
When using Undo (Ctrl+Z) after moving/rotating Openable, Locksets attached to it may ignore the Undo and stay where they are.
Not fixable. Workaround: move Openable back manually without using Undo.
Can’t scale Openable and Lockset blueprints.
Will try to fix in future updates.
After attaching a Static Mesh actor to Openable or Lockset without setting Mobility to Movable, attachment will fail. Solution: change Mobility before attaching. If changed Mobility after attaching the Static Mesh, move the Openable/Lockset or change any property to make the Construction Script run.
Attaching an Actor which has a Static Mesh component and the root component isn’t Static Mesh, collision of Static Mesh will block the attached Openable/Lockset. Solution: make one of the Static Meshes the root of Actor.
Can’t pick up the key for unlocking a Lockset. Solution: make sure the Key actor has a proper collision and Generate Overlap events is set to True for that Collision.
Demo characters in the project are not meant to be used as starting point for your character because PlayerController used for them is very specific to the demo.
Special thanks to Peter Ryan aka TorQue[MoD] for testing, making better models and sounds, and giving some ideas :). He is the founder of Apeirogon Games, please check out his site: http://apeirogon-games.com/
From what I understood, you want to play a sound when you interact with a Lockset which requires a key, right? If so, here is how you can achieve that:
In Blueprints folder -> BP_LocksetPhysics -> “Event Graph” - “Extra Events” comment box you’ll find the “Requires Key” event,
Add a “Play Sound at Location” node connected to that event,
Create a new variable, rename it to “Requires Key”, drag and drop it into “Audio” category, change its type to “Sound Base”, make it Editable by clicking the “eye” icon next to it, get and connect that variable to “Sound” input,
Get the “SourceLocation” variable and connect it to “Location” input.
Here is a screenshot:[SPOILER]
[/SPOILER]
This will make it possible to choose a sound to play when a lockset requires a key.
If this isn’t what you said, please send an email with a bit more detail to support address which you can find here (you need to be logged in to see it).
I’m very interested in buying this product
my question is
how is it possible to integrate into the project called
advanced locomotion
you may do a tutorial
thank you very much
Use advanced locomotion V3
Is it possible that it works?
many things have changed the truth
I would like to see a video that integrates this with a character
I really want to buy
but I would like an extra video
I have seen how it works
has a guide
but a video is missing integrating this
I know that some users who have an advanced character would be interested to see this
Integration is same as PDF or this video. You can add components and input nodes to ALS_BaseCharacter, MannequinCharacter or to your own custom character.
Here is the video of it working with ALS V3 and setup overview:
Hope this answers your questions. Have a nice day!
Hi Nicat. Is it possible to send an unlock msg via trigger as opposed to picking up a key? I wanted one bp to send the openable or lockset and unlock msg. Or open message if possible? (have the door open on its own after an event.
Just add these to your trigger BP. Lockset and Openable variables are types of BP_LocksetPhysics and BP_OpenablePhysics. These variables are used to pick the Lockset/Openable you want to unlock/open.
Unlocking Lockset without a key: Note: you can ignore the Interact node if you just want to remove the key requirement.
Opening door. This is not supported by default but can be achieved easily: Note: change 10 to the velocity you want the door to open at. Note2: if door has multiple locksets, connect the Completed node of above setup to this.
Hi Nicat, I am getting errors packaging my game in 4.18.3. I have exclusive Nativized Blueprints enabled. Getting following Error with your BP. Please help. I included an image.
@Architect3D hey, I wanted to let you know that I’m looking into it. I haven’t tried nativization before and looks like there are some problems with my UE4+VS. So it might take a bit before I can determine what the cause is, if at all. It just looks like it is a bit deeper than simple blueprint script issue. However could you check if BPI_HABInteractable is on nativization list? If it isn’t just add it too (by pressing + sign and choosing the BPI_HABInteractable) and if it helps.
That is a really interesting question :D. At first I thought it wasn’t possible but looks like it is kind of possible but not perfect by any means. I built a demo because I think it is best way to explain why it isn’t perfect. You can download it here: Joystick_OpenableLockset.zip - Google Drive
Few notes: Use left touchpad to move and trigger to grab; Only rotation of hand is used to control “joystick”, location doesn’t matter; I haven’t done any modifications to blueprint to achieve this, except for showing text value. The two meshes are Openable and Lockset blueprints just like door and handle with certain properties; I’ve only tested it on Vive.
@Nicat The drawers don’t work in VR!!! So a bit more info. When you try to open a drawer in VR it stutters badly and won’t come out all the way. My 1st thought was that I must have gone wrong somewhere setting it up for my character so I took another look at your preview video because I remembered that you showed some VR footage in that but you had skipped the part (in VR) where you opened the drawer so then I downloaded the demo from the marketplace page to see how it is meant to work and it was worse and that was in your project demo so it couldn’t have been something I had done. It barely opened at all. Nicat I can go to the trouble of uploading a video of this issue happening if I have to but I have a feeling you are aware of this issue so my question is, why is this happening and how can I fix it?
Could you add suppot for destructibles? I mean… if a door, closet or a lock gets hit and partially destroyed … having the options to add sound and conditions on the blueprint to slow down the simulation… having the a door or closet moving clunky and so on… Or if you can’t then point to code snippets that need modifications to achieve that. So I would avoid having to study all your code to do that.