Obi Official Forum
Help Grab the middle of a rope? - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Help Grab the middle of a rope? (/thread-82.html)

Pages: 1 2


RE: Grab the middle of a rope? - darkcser - 02-05-2018

(01-05-2018, 06:08 AM)niZmo Wrote: Alright I changed some things up, and you were on the right track. Instead of using Linq, Obi has a new method for the constraints called GetFirstBatch(), but the real problem was the colliders hit registration.

Here is the updated code for ObiRope 3.4 and VRTK 3.3.0 alpha. I have also attached the files which is probably easier lol.
This has minimal functionality, a lot of things can be done like attaching 2 particles on grab so the rope doesn't rotate while grabbing with one hand.

Add this to the same gameobject as ObiSolver:

Add this to the same gameobject as your ObiActor:

Wow, thanks for the quick update!

The new code compiled fine but I still could not grab the rope that I created. I also tried it with the chain from the Chain scene in the Obi examples folder.

I used 004_CameraRig_BasicTeleport scene from VRTK as a base, added VRTK_InteractTouch and VRTK_InteractGrab to the controllers, and created a cube set with Windows->VRTK->Setup Interactable Object. Was able to pick up the cube fine with the grip button. I then created a Obi Rope (Fully set up), and added VRTK_ObiInteractableActor and VRTK_ObiInteractableSolver to it. 

In the debugger I can see HandleGrabButtonPressed being triggered but isTouchingParticle seems to always be false. I put a break on HandleSolverCollision but it looks like the contact.distance threshold is never hit. I tried to bump up the collider size in VRTK_ObiInteractableSolver to 0.1 but that didn't help. I noticed that the VRTK_ObiInteractableActor was using ObiPinConstraints so I created some but was not sure what to pin them to.

Am I missing some other step?


RE: Grab the middle of a rope? - niZmo - 03-05-2018

Are you trying to use the new SDKManager_Constructor Scene, or setting up VRTK manually by making a gameobject and adding SDKmanager.cs to it, ect?

I just tried to repeat the steps and going from scratch this time, I see VRTK added this new scene to handle the SDKManager. The problem with using this extra scene is the SDKManager.instance is null for some reason, so nothing gets set up to interact with the rope. I'm trying to figure out how to access it with the new way but haven't got it yet. There are instructions on how to setup VRTK manually, after that it should work. I'll look into it a little more but as you may see on line 70 of the InteractableSolver.cs the instance of the VRTK_SDKManager is null.

https://github.com/thestonefox/VRTK/blob/release/3.3.0-alpha/Assets/VRTK/Documentation/GETTING_STARTED.md


RE: Grab the middle of a rope? - darkcser - 04-05-2018

(03-05-2018, 12:54 AM)niZmo Wrote: Are you trying to use the new SDKManager_Constructor Scene, or setting up VRTK manually by making a gameobject and adding SDKmanager.cs to it, ect?

I just tried to repeat the steps and going from scratch this time, I see VRTK added this new scene to handle the SDKManager. The problem with using this extra scene is the SDKManager.instance is null for some reason, so nothing gets set up to interact with the rope. I'm trying to figure out how to access it with the new way but haven't got it yet. There are instructions on how to setup VRTK manually, after that it should work. I'll look into it a little more but as you may see on line 70 of the InteractableSolver.cs the instance of the VRTK_SDKManager is null.

https://github.com/thestonefox/VRTK/blob/release/3.3.0-alpha/Assets/VRTK/Documentation/GETTING_STARTED.md

Thanks for the reply!

I will set it up manually this time, and give it a whirl. 

VRTK is still kind of mystifying for me at times in the way that it behaves. For some reason with the github version of 3.3.0a it always has the controllers invisible for me. The updateposes issue was supposed to have been fixed but they still don't show up. I spent hours messing with it until it suddenly just showed up by itself -I thought it was because I opened the custom controller scene. Of course I then tried it on another clean copy from github but of course it didn't work, and the controllers were still invisible. Some odd combination of events or changes fixed it. Now I just branch off of the mysteriously working version... 

There's this section from Github:

(https://github.com/thestonefox/VRTK)

Important Note

The example scenes no longer contain the VRTK_SDKManager as this is loaded in at runtime via the VRTK_SDKManager_Constructor scene. As the VRTK_SDKManager script is responsible for setting up the required Unity Scripting Define Symbols for installed SDKs it is required that the VRTK_SDKManager_Constructor scene is opened in the Unity Editor when first using the project or when installing a new supported SDK so it can set up the scripting define symbols. The example scenes will not work until the scripting define symbols have been set up correctly so please ensure that the VRTK_SDKManager_Constructor scene is loaded into the Unity Editor first.

I'm not quite sure what "ensure that VRTK_SDKManager_Constructor scene is loaded into the Unity Editor first." I tried loading that scene and another example scene at the same time but it didn't seem to do anything different.

Hopefully with version 4, things will be a bit more transparent. I was a bit disappointed that it was Oculus that sponsored them instead of HTC. I hope the SteamVR support continues to be good.


RE: Grab the middle of a rope? - darkcser - 05-05-2018

(04-05-2018, 04:13 PM)darkcser Wrote: Thanks for the reply!

I will set it up manually this time, and give it a whirl. 

VRTK is still kind of mystifying for me at times in the way that it behaves. For some reason with the github version of 3.3.0a it always has the controllers invisible for me. The updateposes issue was supposed to have been fixed but they still don't show up. I spent hours messing with it until it suddenly just showed up by itself -I thought it was because I opened the custom controller scene. Of course I then tried it on another clean copy from github but of course it didn't work, and the controllers were still invisible. Some odd combination of events or changes fixed it. Now I just branch off of the mysteriously working version... 

There's this section from Github:

(https://github.com/thestonefox/VRTK)

Important Note

The example scenes no longer contain the VRTK_SDKManager as this is loaded in at runtime via the VRTK_SDKManager_Constructor scene. As the VRTK_SDKManager script is responsible for setting up the required Unity Scripting Define Symbols for installed SDKs it is required that the VRTK_SDKManager_Constructor scene is opened in the Unity Editor when first using the project or when installing a new supported SDK so it can set up the scripting define symbols. The example scenes will not work until the scripting define symbols have been set up correctly so please ensure that the VRTK_SDKManager_Constructor scene is loaded into the Unity Editor first.

I'm not quite sure what "ensure that VRTK_SDKManager_Constructor scene is loaded into the Unity Editor first." I tried loading that scene and another example scene at the same time but it didn't seem to do anything different.

Hopefully with version 4, things will be a bit more transparent. I was a bit disappointed that it was Oculus that sponsored them instead of HTC. I hope the SteamVR support continues to be good.


I tried to do the manual setup instructions from above. In addition I added the left and right controllers to SDK Manager script aliases and also VRTK InteractGrab and VRTK InteractTouch to both controllers. Also had to remember to disable the main camera -my controllers were very far from the headset until I realized that the main camera was still enabled. 

I can see that SDKManager.Instance is being populated when it's called on line 70 in Awake. It looks like the issue might be with HandleSolverCollision when I try it this way.  The event handler seems to be triggering all the time despite the contacts being zero. Is this the expected behavior? I thought it should only trigger when an ObiCollider touches a particle in an actor associated with the solver?

I can see the programmatically generated obi colliders on the controllers but when the controller goes through the rope though it still doesn't show any contacts. Oddly enough if I put an Obi Collider at design time on the controllers I can see the contacts from collisions. Do Obi Colliders created at runtime need to be registered somehow?