Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: jasonj_76 on June 12, 2016, 12:02:37 AM

Title: SteamVr OnTriggerEnter
Post by: jasonj_76 on June 12, 2016, 12:02:37 AM
Hi,

I'm a new user and I've been going through tutorials online.  I got the tutorial on Triggers ( to work nicely but I thought it would be great to get it working with the Vive and SteamVr.  Unfortunately, the SteamVr camera doesn't seem to trigger the Trigger Event.  I've added a capsule collider to the steamvr camera and I can see it moving into the trigger, but nothing happens.  I've confirmed that this works with the First-Person Controller. 

Has anyone had any luck with this?

thanks for your help,
Jason
Title: Re: SteamVr OnTriggerEnter
Post by: sebaslive on June 12, 2016, 04:07:59 PM
Hi, did you try adding a rigidbody?
Title: Re: SteamVr OnTriggerEnter
Post by: jasonj_76 on June 12, 2016, 08:45:41 PM
Yeah, I've added a rigidbody and a collider to the Camera(Head) in the SteamVr rig. Unfortunately it still doesn't trigger.
Title: Re: SteamVr OnTriggerEnter
Post by: sebaslive on June 12, 2016, 11:23:14 PM
Ill do some tests tomorrow and see if I can help out.
Title: Re: SteamVr OnTriggerEnter
Post by: jasonj_76 on June 12, 2016, 11:35:00 PM
Great, I appreciate the help.

-Jason
Title: Re: SteamVr OnTriggerEnter
Post by: sebaslive on June 14, 2016, 09:31:47 PM
Hey Jason I just tried it out and it worked on my end,

I placed a circle collider on my camera(head) and set it with a rigidBody and turned on trigger for the collider.

Then I placed a box with a box collider with trigger enabled. When I moved my head into the box collider I was able to OntriggerEnter with tag and it worked.
Title: Re: SteamVr OnTriggerEnter
Post by: jasonj_76 on June 19, 2016, 08:03:39 PM
Thanks for taking a look.  I took another stab at it and tried your setup, but I'm still having issues. 

I must be doing something wrong on my end.  I can get it all to work with the regular fps camera, but not with steamvr. 

If you have a second, can you take a look to see what I'm doing wrong? Here is a link to the project:

[ADMIN: Link removed since it included Playmaker dlls]

thanks,
Jason

Title: Re: SteamVr OnTriggerEnter
Post by: sebaslive on June 20, 2016, 01:34:42 AM
Hey Jason so a couple of things you have to do.

first remove this package because it has your playmaker file in it :P
(edit: I see admin removed it already)

second, you have regular trigger event on your button with a regular box collider (by regular I mean that it is looking for 3D triggers) but on your camera (head) you placed a rigidbody2D with a circle collider 2D. Either change button to have a 2D collider as well with trigger2D Event instead of the regular Trigger Event OR remove the circle collider 2D and the rigidbody 2D on the camera with a regular rigidbody and a regular circle collider.

third and last, notice that the camera (head) also has a tag - MainCamera, even with all the changes from the last step you still need to set the triggers collide tag to Main Camera, instead of Untagged.

The reason the FPS controller worked was because it has that Character Controller (which is a regular 3D collider) and the tag is set to Untagged, which the button is set to look for.

When doing the changes don't forget to set to Is Trigger (which you have already set, but just in case).

That should do it!
Title: Re: SteamVr OnTriggerEnter
Post by: jasonj_76 on June 20, 2016, 02:12:24 AM
Yes! That worked perfectly.  The collide tag on the trigger event was throwing me off, that was main culprit.  It didn't even cross my mind to change that to main_cam.  Thank you for taking the time to look at my setup and for helping me.   

-Jason

Title: Re: SteamVr OnTriggerEnter
Post by: sebaslive on June 20, 2016, 08:27:20 AM
Great! That has happened plenty of times to me and I had no idea why. Glad it worked out.
Title: Re: SteamVr OnTriggerEnter
Post by: fletcherkildren on January 03, 2018, 06:54:14 AM
Came across this - is there a way to adapt this to prevent collisions? Like make the camera not clip through things like the camera in Tomb Raider?
Title: Re: SteamVr OnTriggerEnter / Exit
Post by: CraigItsFryday on April 17, 2018, 09:49:20 AM
Hi everyone,

I came across this thread looking for this exact answer. Unfortunately, the fixes for the OP have not been enough to fix my problem. I've been able to get my trigger to work using a simple sphere object with a trigger, but when I attempt to use a sphere collider on the SteamVR head object, it simply doesn't work. I'm wondering if it has something to do with teleporting into a volume instead of walking or moving my head directly into it? I've noticed the bezier ray (using Vive teleport via GitHub) bounces off of the trigger volume (or at least gives an invalid surface as feedback) but I've managed to teleport slowly into the volume. I've tried manually moving the CameraRig into the trigger volume and it doesn't fire off then either. I'm wondering if there's any advice on what to try next. Or if possibly updates to SteamVR could have broken this approach. I've had no other issues with triggers until trying to use them with SteamVR. Any help is appreciated. Thanks in advance.
Title: Re: SteamVr OnTriggerEnter
Post by: CraigItsFryday on April 17, 2018, 09:56:07 AM
I guess sometimes the act of asking for help is alone enough. Immediately saw my problem after trying one more thing. In case someone else has the same issue, the head is disabled (for me, not sure) once the camera is running. Moving the rigidbody and collider (trigger) to the eyes allowed it to work for me.