Need help making script for keys

Hi, I need help making a script for a key system for my game (PlayCanvas | HTML5 Game Engine)
I want to be able to assign the amount of keys, what objects to be keys and what object to be the lock.
When all the keys are used (by pressing E when looking at the lock object) I want it to send a signal to the lock that the lock can receive and use to trigger an action.

@teczito I am not really sure how to answer your question. Is it that you want the player to look at an object and then press the E key to lock or unlock a door? If so this can be done by a ray cast method. If you have a look to this project you will see the scripts I have created to do this for some doors. If you look at the door and press the E key they will open. The F key will shut the doors. Hope tis helps.

https://playcanvas.com/project/939691/overview/spacedoors

1 Like

hi thanks but do you know how to use it for swing doors