Playmaker Forum

PlayMaker Help & Tips => VR Help => Topic started by: beowulfkaine on April 21, 2017, 04:39:30 PM

Title: Dont have much hair left trying to figure this out, VR Help Please
Post by: beowulfkaine on April 21, 2017, 04:39:30 PM
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.

(https://i.imgur.com/4eKImkZ.jpg)
Title: Re: Dont have much hair left trying to figure this out, VR Help Please
Post by: tcmeric 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.
Title: Re: Dont have much hair left trying to figure this out, VR Help Please
Post by: tcmeric 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
Title: Re: Dont have much hair left trying to figure this out, VR Help Please
Post by: beowulfkaine on April 22, 2017, 12:59:53 PM
THANK YOU! YOU ARE THE 9TH INCARNATION OF THE BUDDHA!

(http://topyaps.com/wp-content/uploads/2014/05/Ninth-Incarnation-Of-Lord-Vishnu.jpg)
Title: Re: Dont have much hair left trying to figure this out, VR Help Please
Post by: beowulfkaine 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?
Title: Re: Dont have much hair left trying to figure this out, VR Help Please
Post by: tcmeric 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.
Title: Re: Dont have much hair left trying to figure this out, VR Help Please
Post by: beowulfkaine 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!
Title: Re: Dont have much hair left trying to figure this out, VR Help Please
Post by: tcmeric 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.
Title: Re: Dont have much hair left trying to figure this out, VR Help Please
Post by: beowulfkaine 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
Title: Re: Dont have much hair left trying to figure this out, VR Help Please
Post by: beowulfkaine 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?
Title: Re: Dont have much hair left trying to figure this out, VR Help Please
Post by: tcmeric 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?
Title: Re: Dont have much hair left trying to figure this out, VR Help Please
Post by: beowulfkaine 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 (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.
Title: Re: Dont have much hair left trying to figure this out, VR Help Please
Post by: tcmeric on April 26, 2017, 08:22:26 AM
Glad you got it worked out  :)
Title: Re: Dont have much hair left trying to figure this out, VR Help Please
Post by: beowulfkaine 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!
Title: Re: Dont have much hair left trying to figure this out, VR Help Please
Post by: beowulfkaine 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?
Title: Re: Dont have much hair left trying to figure this out, VR Help Please
Post by: tcmeric on April 26, 2017, 09:18:09 PM
Why the need for the colider on the the switch? You are grabbing and pulling the switch down right? If so, it should be activated until you are able to grab it anyways (therefore why the need for the extra detection of the controller entering its space?).
Title: Re: Dont have much hair left trying to figure this out, VR Help Please
Post by: beowulfkaine on April 26, 2017, 09:21:20 PM
I meant the toggle button itself. As it is the entire object lights up, I would like it to be just the toggle switch outline as well as the breaker.  Not sure where I saw this but I am trying to remember how to do it
Title: Re: Dont have much hair left trying to figure this out, VR Help Please
Post by: beowulfkaine on May 02, 2017, 11:05:43 PM
OK here is a sample of all the tutorials you have made and also the tips you gave me.  It's got a few bugs and this is not  a whole game, its a very small piece of something.  You need a HTC Vive to play this.

The solution to the breaker puzzle is red on the 1 row and 3 row, green on the 3rd row and yellow in the middle.

Also the flash light has no gravity but can be grabbed.  Also you can only use the left controller because I haven't figured out how to make playmaker use which ever controller is used yet.

Oh controls are the grip to grab and place, the trigger to use on the breakers which need to be turned on.

Room doesn't have any safety so if you fall through a door, your boned.

http://www.grumpyotisgames.com/temp/basement.rar (http://www.grumpyotisgames.com/temp/basement.rar)