Padlock Sys - Setup
Padlock System - Setup Video
Padlock Controller Main Setup
How to add a trigger event to for this system?
Basic Steps
Make sure the main camera has an empty GameObject called "Padlocks" which you will add the "Mechanism" locks to, if not already attached.
Add the "Padlock Objects" to the scene, which will have:
"Padlock_Interactable" which needs:
A tag of "InteractiveObjects"
A layer of "Interact"
Add a "Box Collider"
Add a "AKItemController" script
Add a "PadlockItemController" script and add the "Padlock_Controller" object to the slot (As below)
Padlock_Controller needs a padlock controller script: "PadlockController"
See setup details below
Door object or similar with your custom script or the "DoorAnimationScript"
See example setup details below
Padlock Objects Setup
Main Camera Setup Example
The Main Camera has an Empty GameObject called "Padlocks"
Then 4 different padlocks each with separate features
LockMechanism - Is the Latch with the animation when the lock opens
PadlockCombination - The Spinners with the "SpinnerScript" attached
Padlock World Objects Example
Padlock_Interactable_A2: This is a PBR 3D Padlock
Padlock_Controller_A2: Empty GameObject with the Padlock Controller script
Door_A1: The door object you want to open
FrameComponent: Some additional 3D assets (NOT REQUIRED)
Padlock Controller Setup
This object should be an empty GameObject and it will control everything that goes on for your flashlight system!
Combination and Camera Padlock References:
Your Combination | The 4 number combination to unlock the padlock |
Camera Padlock | Add the "Padlock_Camera_Mechanism_A1" from the padlock attached to the camera |
Lock Anim | Add the "LockMechanism_A1" from the "Padlock_Mechanism" attached to the camera |
World Objects:
Interactable Lock | Add the "Padlock_Interactable_A2" or similar 3D object which is the world object |
Trigger Type - ONLY If using a trigger event:
Trigger Event | Add the "Padlock Trigger" which will be a gameobject you create |
IsPadlockTrigger | Tick if you're using a Padlock Trigger |
Unlock Events:
You can use the "+" icon to add an event for when you get the correct code, you can add custom interactions if you create a new script with a public method to open a door, or some other object. I have added a simple example "PadlockDoorAnimation". See the code below:
Padlock Interactable Item Controller
Add this script to either a PBR 3D Padlock that you will interact with
Make sure your object has a tag of "InteractiveObject" and a Layer of "Interact"
Add a "Box Collider" to your object
Add an "AKItemController" - Set the System Type to: "PadlockSys"
Add a "PadlockItemController" script to the object
Padlock Controller variable: Add the connected "Padlock_Controller"
Padlock Spinner / Combination Setup
Add this script to a Padlock spinner that is on the padlock within the main camera.
Add a "Box Collider" to your object
Make sure this object has a "Rigidbody"
Add an "SpinnerScript"
"PadlockController Variable": Add the "Padlock_Controller" object to each of the spinners
Set the row of each spinner. Row 1 - 4.
Default Controls
Left Click to interact with a pickup
Right Click to drop the padlock
Left Click to interact with the spinners (When Interacting)
These can be edited in the "InputManager"
Last updated