playMaker

Author Topic: VRTK Actions  (Read 19933 times)

Doh

  • Full Member
  • ***
  • Posts: 124
Re: VRTK Actions
« Reply #30 on: May 31, 2017, 06:34:24 AM »
I am correct in thinking that the action checks what a specific interactable object is being grabbed by, aren't I?

Sadly that action is not practical in my case as I'd have to check every grabbable object in the game to be able to say with certainty that no object is being grabbed.

In my case I'm trying to ask a controller if it is grabbing anything, where as "get grabbed objects gameobject" asks an interactable object which object is grabbing it.

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: VRTK Actions
« Reply #31 on: May 31, 2017, 06:59:01 AM »
Hmm, you are indeed correct. My mistake. Ill see what I can do for an action for this.

Doh

  • Full Member
  • ***
  • Posts: 124
Re: VRTK Actions
« Reply #32 on: May 31, 2017, 07:11:54 AM »
Cheers Tmeric!

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: VRTK Actions
« Reply #33 on: May 31, 2017, 08:12:40 AM »
Hi, give this a try and let me know if it works. It uses the event system, so it is listening for a grab event or a ungrab event. I am going to try and refine it a bit better, but you can start using it if you want, if you are in a rush.

Doh

  • Full Member
  • ***
  • Posts: 124
Re: VRTK Actions
« Reply #34 on: May 31, 2017, 08:44:13 AM »
Yeah these work well cheers! I'm using a fair few actions to achieve the desired effect but they certainly do the trick.

I'll keep checking back in case you can refine it.

Thanks!

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: VRTK Actions
« Reply #35 on: May 31, 2017, 08:45:08 AM »
Here is an updated version that triggers a playmaker event in the action optionally.

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: VRTK Actions
« Reply #36 on: May 31, 2017, 08:46:15 AM »
(The event should be triggered when an object is picked up, for example). It should also be a tiny bit more performant, as it unloads the listener after the action exits. (Behind the scenes stuff).
« Last Edit: May 31, 2017, 08:47:47 AM by tcmeric »

Doh

  • Full Member
  • ***
  • Posts: 124
Re: VRTK Actions
« Reply #37 on: May 31, 2017, 09:11:56 AM »
Works brilliantly!

It throws up an error in editor if the events script isn't there outside of runtime though that's no issue.

Does a listener of this scale cost much performance-wise? Guessing it must be checking every frame.

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: VRTK Actions
« Reply #38 on: May 31, 2017, 09:29:44 AM »
What error shows up? It should prompt you to add the correct script to the controller gameobject if it hasent been added (otherwise this action cannot run).

Yes, listeners need to run in everyframe in order to listen for changes. It shouldnt be anymore expensive then listening for on trigger events or keydowns, etc as far as I am aware.

Basically this is how VRTK does it, and I am just hooking into their listener using unity events.  8)

Doh

  • Full Member
  • ***
  • Posts: 124
Re: VRTK Actions
« Reply #39 on: May 31, 2017, 09:43:19 AM »
Yeah just the prompt to add the script, it adds itself at runtime if it's not there anyway. I've added mine in editor though, so all good!

Awesome, I'm quids in on the total listeners front as I toggle most of them on/off depending on where the player is, so I should be fine with these.

edufurla

  • Junior Playmaker
  • **
  • Posts: 56
Re: VRTK Actions
« Reply #40 on: June 23, 2017, 12:59:33 PM »
Hi Tcmeric. Fantastic actions. Thanks for that!!!
I am trying to use pointerDestinationInfo but when I use models with parent structure the action only shows the name of the parent object, even when I point to some child object.
Are there any way to show the name of the point object like raycast do?

Thank you

edufurla

  • Junior Playmaker
  • **
  • Posts: 56
Re: VRTK Actions
« Reply #41 on: June 23, 2017, 01:06:47 PM »
My bad. I was missing a big collider on the father object.
Thx