playMaker

Author Topic: Dont have much hair left trying to figure this out, VR Help Please  (Read 12872 times)

beowulfkaine

  • Playmaker Newbie
  • *
  • Posts: 47
I'm new to playmaker and not much of a coder (the reason why I'm using PLaymaker)  I bought the SteamVR playmaker asset but I've been having trouble for weeks trying to figure it out.

This is all I want to do:

I want to make a light switch. I want either controller to be able to do it and I would like for it to store either a variable or a boole (if its on or off and possible a value for other things) a simple on or off with a sound.

Can anyone help me? I'm at my wits end, ELI5 please.

« Last Edit: April 21, 2017, 04:43:27 PM by beowulfkaine »

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Dont have much hair left trying to figure this out, VR Help Please
« Reply #1 on: April 22, 2017, 06:09:46 AM »
Keep that hair!  ;D

I wrote a playmaker VRTK script for you. It gets the angle of the lever into a float, which you can then do a float compare on.

Ill make a tutorial video for you. Ill post it here once its done. Ill see if I can get it done today.

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Dont have much hair left trying to figure this out, VR Help Please
« Reply #2 on: April 22, 2017, 09:26:46 AM »
Here is a tutorial on working with levers in VRTK and Playmaker:
It is very step by step.

This is the custom action needed to make it work: https://github.com/dumbgamedev/VRTK_Playmaker3x/blob/master/Interactions/Grab/GetLeverAngle.cs

beowulfkaine

  • Playmaker Newbie
  • *
  • Posts: 47
Re: Dont have much hair left trying to figure this out, VR Help Please
« Reply #3 on: April 22, 2017, 12:59:53 PM »
THANK YOU! YOU ARE THE 9TH INCARNATION OF THE BUDDHA!


beowulfkaine

  • Playmaker Newbie
  • *
  • Posts: 47
Re: Dont have much hair left trying to figure this out, VR Help Please
« Reply #4 on: April 23, 2017, 06:21:00 PM »
I have another question,, so everything is working out great! I'm wondering what it would take to allow a button to only work when an object is held? Also, I was using your VTK Playmaker scripts and noticed the only way to attach these to objects is to select either left or right? Am I missing it where I can have whichever controller picks it up?

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Dont have much hair left trying to figure this out, VR Help Please
« Reply #5 on: April 23, 2017, 08:14:33 PM »
Glad to hear it is working out.

1. I dont think I have an action yet for, is object being held (bool). I can check to see if this is supported in the VRTK code. For now, if you want, you can just check to see if your grab button is being held. For example, if your trigger is your grab button (this is set in VRTK usually), then use the action "get trigger pressed". This returns a bool. You can do a bool test and bool changed on this variable. I think this is the right tutorial to show you how to do the bool test/check on a button. In this case I talk about a menu button, but its the same idea:
Even if I make a specific actions for object being held, it will still need this same bool check/test.

2. Regarding right/left, this is not due to my actions per se, but because of VRTK (because of how vive works). The easist way to deal with this, is to have two FSM. One for each controller. Just like when you setup VRTK, you need each script on each controller.

beowulfkaine

  • Playmaker Newbie
  • *
  • Posts: 47
Re: Dont have much hair left trying to figure this out, VR Help Please
« Reply #6 on: April 24, 2017, 09:13:48 AM »
Thank You! That will help me a lot  ;D! Your video was exactly what I needed as well, thanks again for your help!

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Dont have much hair left trying to figure this out, VR Help Please
« Reply #7 on: April 24, 2017, 11:46:14 AM »
Cool, no problem.

I have been working on the VRTK snap zone actions. Just about finished. All written, just need to clean up my code and document it. After that, I will add it to github and make a video for it.

beowulfkaine

  • Playmaker Newbie
  • *
  • Posts: 47
Re: Dont have much hair left trying to figure this out, VR Help Please
« Reply #8 on: April 24, 2017, 12:05:55 PM »
That's awesome man, thanks for all your help. I'll give you a cameo in my game lol if I ever get it finished

beowulfkaine

  • Playmaker Newbie
  • *
  • Posts: 47
Re: Dont have much hair left trying to figure this out, VR Help Please
« Reply #9 on: April 25, 2017, 12:38:21 AM »
Hey I have a question.  I'm trying to replicate what you did in the "Playmaker + VRTK Controller Actions in Unity: Basic Introduction" and every time I click and drag the Left or Right VRTK Controller it disappears as soon as I run play and gives mes this:

"No model container could be found. Have you selected a valid Controller SDK in the SDK Manager? If you are unsure, then click the GameObject with the `VRTK_SDKManager` script attached to it in Edit Mode and select a Controller SDK from the dropdown."

I can click and drag that thing all day and it keeps giving me that error. I can see you doing it so it's puzzling as to why I cant do?

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Dont have much hair left trying to figure this out, VR Help Please
« Reply #10 on: April 25, 2017, 03:07:32 AM »
Can you refresh my memory. What is the time in the video that I did that (so i can have a look).

When you hit play, is the VRTK controller still in your hierarchy? Can you send some screenshots of the your FSM? And a screenshot of your controllers scripts that it has attached?

beowulfkaine

  • Playmaker Newbie
  • *
  • Posts: 47
Re: Dont have much hair left trying to figure this out, VR Help Please
« Reply #11 on: April 25, 2017, 02:50:37 PM »
Can you refresh my memory. What is the time in the video that I did that (so i can have a look).

When you hit play, is the VRTK controller still in your hierarchy? Can you send some screenshots of the your FSM? And a screenshot of your controllers scripts that it has attached?

I made a video to get a better video of what I'm talking about:;

https://youtu.be/7CgGAcLLjKA

[edit] : Not 15 Minutes Later:

Well I finally figured it out, it turns out that since my "Player" character is in his own scene and I have these scenes are all loaded at once, apparently the get trigger from VRTK shows missing because the player scene is either not loaded yet or ?? Either way, I moved the player back into the scene its in and all is working as it should be.

The reason I had the player in a separate scene is because I wanted to have the player separate to easily move him in between scenes as I have a huge mansion that is loaded into separate scenes at runtime when entering the area.  Honestly this makes so much sense now, frustrating that I've been monkey dangling this for like 2 weeks trying to figure this out.

TAKEAWAY: Player & VRTK must be in the same scene that is getting requested to use VRTK controllers.
« Last Edit: April 25, 2017, 04:52:53 PM by beowulfkaine »

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Dont have much hair left trying to figure this out, VR Help Please
« Reply #12 on: April 26, 2017, 08:22:26 AM »
Glad you got it worked out  :)

beowulfkaine

  • Playmaker Newbie
  • *
  • Posts: 47
Re: Dont have much hair left trying to figure this out, VR Help Please
« Reply #13 on: April 26, 2017, 01:32:04 PM »
Again I want to thank you for all the help you have given me, It's been invaluable.  You should do like a training course like this guy: http://thestrangeschool.com/

I would totally pay!

beowulfkaine

  • Playmaker Newbie
  • *
  • Posts: 47
Re: Dont have much hair left trying to figure this out, VR Help Please
« Reply #14 on: April 26, 2017, 03:41:41 PM »
Its amazing the more I mess with playmaker the more it makes sense. I guess daily use would just increase proficiency!

I do have a question. I have everything working exactly as I would like, I have the breaker being able to be grabbed, I have a trigger collider on the switch so when the controller enters the collider they can activate the switch and not from anywhere. (though I have noticed that if I am holding the breaker I cannot activate the switch because the collider is not registering a collision from the controller because its disabled. Since the rigid body option only works when something is not in the hand is there a way to tell the fsm that an object in hand is ok to be used?

Well my actual question is this. For now I can only get one controller to work, its odd too because I will specify say for example left controller, and now and again it will switch from the physical controller as to which is considered left?

But anyway, my thinking is, if I can set the enter trigger controller as a bool then use that as the get trigger pressed bool somehow, then which ever one enters will be used? Not sure how I would do that or if it can be done? What do you think?