• Hi Guest!

    We are extremely excited to announce the release of our first Beta for VaM2, the next generation of Virt-A-Mate which is currently in development.
    To participate in the Beta, a subscription to the Entertainer or Creator Tier is required. Once subscribed, download instructions can be found here.

    Click here for information and guides regarding the VaM2 beta. Join our Discord server for more announcements and community discussion about VaM2.
Triggers: Inputs and Collisions

Plugins + Scripts Triggers: Inputs and Collisions

Download [<1 MB]

TBD

Well-known member
Joined
Jan 23, 2022
Messages
456
Reactions
721
TBD submitted a new resource:

Triggers: Inputs and Collisions - triggers for keyboard/mouse/vr controller inputs and collisions of individual parts of atoms

Two plugins that allow you to create configurable triggers for events:
  1. Input triggers: react to keyboard, mouse and VR controller inputs
  2. Collision triggers: react to collisions between specific parts of atoms.
    You can select rigidbodies and individual colliders (e.g. left shoulder or glutes)
Input Triggers
This plugin lets you bind key down/up triggers for any input event. It supports keyboard, mouse and VR controllers.
[ATTACH type="full"...

Read more about this resource...
 
!> Exception during plugin script Init: System.NullReferenceException: Object reference not set to an instance of an object
at TBD.Triggers.CollisionTriggers+<Init>c__AnonStorey1.<>m__0 (UnityEngine.Collider c) [0x00000] in <filename unknown>:0
at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[UnityEngine.Collider].MoveNext () [0x00000] in <filename unknown>:0
at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[UnityEngine.Collider].MoveNext () [0x00000] in <filename unknown>:0
at System.Linq.Enumerable+<CreateGroupByIterator>c__Iterator5`2[UnityEngine.Collider,System.String].MoveNext () [0x00000] in <filename unknown>:0
at TBD.Triggers.CollisionTriggers.Init () [0x00000] in <filename unknown>:0
at MVRPluginManager.CreateScriptController (.MVRPlugin mvrp, DynamicCSharp.ScriptType type) [0x00000] in <filename unknown>:0

This is an error message that appears when you add a collision trigger plugin to a character.
This is resolved by resetting the pose.

Is it possible to trigger an event for a collision trigger only with the VR hand?
Is it possible to go further and specify just one of multiple assets and trigger a conflict trigger event only on that asset?
 
Last edited:
TBD updated Triggers: Inputs and Collisions with a new update entry:

some fixes and improvements

Changelog v3

Collision Triggers Plugin:
  • Fixed collision trigger plugin for simple atoms (e.g. Cube) not showing any colliders.
  • Reworked collider groups to be more readable and sort better.
  • Added a button to refresh the collider UI in case any were removed from or added to the atom.
  • Changed the default behaviour for colliders, which are added to rigidbodies after the plugin is initialized, to be enabled instead of disabled.
    This change is targeted at toggling glute...

Read the rest of this update entry...
 
TBD updated Triggers: Inputs and Collisions with a new update entry:

down the rabbit hole we go

Damn, this turned out to be a far deeper rabbit hole than expected. I learned a whole lot about what vam does internally when you toggle a person's soft glute physics on or off. The final epiphany came to me while I was hunting down a bug with spanking sounds in vammoan2. 😄

Changelog v4
  • resolved the previous version's limitations related to enabling or disabling a person's glute soft physics

Read the rest of this update entry...
 
TBD updated Triggers: Inputs and Collisions with a new update entry:

production ready

Evidently, finding colliders for specific rigidbodies while also including currently inactive ones is less straight forward than I realized. This resulted in e.g. neck colliders appearing in the abdomen category. Drilling further into vam's code revealed the solution (IgnoreChildColliders MonoBehaviour).

I consider this release fully tested and production ready. There won't be any breaking changes going forward, either.
Please shout at me if you find any other bugs.

changelog v5...

Read the rest of this update entry...
 
Yo TBD!

I have something in the works for @VaMDeV , but I'm pretty sure it would have it's place in this plugin as you cover some needs already. And that would be dumb to have to libs doing pretty much similar stuffs.

Do you think like a customizable sphere/cube collider with possible triggers being :
  • Target atom
  • VR hands only
  • VR head only
  • or VR heads + hands
Would be something you think interesting for your plugin?
 
The plugin already supports simple shapes' colliders. I could add a target atom filter. I don't know about the VR head, though. Does it even have a collider? Do you know the atom, rigidbody and collider names for that?
 
Dumb question here (probably) but, for what keyboard layout is the key list? i have italian layout so, i expected that some symbols wheren't the same code but, i've tried some symbols that have a common position with the US international keyboard ($ = shift+4 for example) but the trigger doesn't work. Did i missed something? maybe shifted keys aren't supported?
I had success instead if i use "normal" keys like letters, keypad, SHIFT only, etc

BTW love your plugin, is ages i was looking for a simple way to have triggers on keyboards and VR controller, thank you for that =)
 
Last edited:
Dumb question here (probably) but, for what keyboard layout is the key list? i have italian layout so, i expected that some symbols wheren't the same code but, i've tried some symbols that have a common position with the US international keyboard ($ = shift+4 for example) but the trigger doesn't work. Did i missed something? maybe shifted keys aren't supported?
I had success instead if i use "normal" keys like letters, keypad, SHIFT only, etc

BTW love your plugin, is ages i was looking for a simple way to have triggers on keyboards and VR controller, thank you for that =)
Hi, modifiers aren't handled by unity and the plugin doesn't implement custom support for it. As of now, only individual keys can be used.
The plugin uses UnityEngine.KeyCode to identify buttons:

It seems VAM did not configure Unity to use physical keys, so they're mapped differently depending on language. With my QWERTZ layout, the plugin's triggers for Y and Z keys map according to the key's label, instead of being swapped. Comma and full stop work, too.
You will only be able to use characters, which you have individual keys for on your keyboard, regardless of where they are.
 
PS: If you need it, you can create modifier logic with e.g. MacGruber.LogicBricks relay. Set up a trigger for shift, which toggles "accept trigger" on the relay, and then trigger the relay with another key.
 
Thank you for answering, now i fully understand. Will try to use "single" keys...
I've also noticed that in the VR Controller section i see only "Grab" "HoldGrab" "RemoteGrab" and "RemoteHoldGrab" with left and right options..
I own a Quest2 and obviously i have more mappable buttons on the controller (A,B,X,Y,trigger, etc).. is normal i can't set those additional buttons with your plugin?
I admit that i only checked the plugin in desktop mode so, i don't know if the ones shown in the plugin are generic buttons because i didn't had my controllers activated but, i wanted to ask anyway =)

Thank you !
 
Thank you for answering, now i fully understand. Will try to use "single" keys...
I've also noticed that in the VR Controller section i see only "Grab" "HoldGrab" "RemoteGrab" and "RemoteHoldGrab" with left and right options..
I own a Quest2 and obviously i have more mappable buttons on the controller (A,B,X,Y,trigger, etc).. is normal i can't set those additional buttons with your plugin?
I admit that i only checked the plugin in desktop mode so, i don't know if the ones shown in the plugin are generic buttons because i didn't had my controllers activated but, i wanted to ask anyway =)

Thank you !
Yeah, the reason for that is similar. VaM has an abstraction layer, through which you can read the state of common buttons. Without it you'd have to deal with all of the different hardware and with the SteamVR and OpenVR APIs individually. I'm not even sure you can talk to those APIs from the plugin sandbox. I could try it but either way, I don't have access to headsets to test it.
Here's a peek at what vam does internally to handle button states:
Code:
    public bool GetLeftGrab()
    {
        if (isOVR)
        {
            if (UserPreferences.singleton.oculusSwapGrabAndTrigger)
            {
                return OVRInput.GetDown(OVRInput.Button.PrimaryHandTrigger, OVRInput.Controller.Touch);
            }

            return OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger, OVRInput.Controller.Touch);
        }

        if (isOpenVR)
        {
            return grabAction.GetStateDown((SteamVR_Input_Sources)1);
        }

        return false;
    }
 
Love this plugin, thank you so much! (y)
What is the difference between Grab and RemoteGrab binds in VR?
Is there a specific way to press it, because for me it triggers both on key press? :unsure:
 
Love this plugin, thank you so much! (y)
What is the difference between Grab and RemoteGrab binds in VR?
Is there a specific way to press it, because for me it triggers both on key press? :unsure:
I'm not quite sure. Looking at vam's code, they do very similar things. RemoteGrab excludes some GUI interactions, it seems.
 
Is this compatible with altfuta? It doesn't seem to be, but I wanted to ask to be sure
It is but there are limitations due to the way altfuta modifies the character's colliders (or rather the timing of it). You need to refresh the collision triggers plugin after altfuta is done with its' initialization. That's exactly why I exposed the refresh function as a triggerable action in a recent update. A discord user had the same issue and this let him work around it.
 
Back
Top Bottom