![]() |
Help Grab Rope - VR - 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 Rope - VR (/thread-2422.html) |
RE: Grab Rope - VR - josemendez - 24-02-2021 If you're using Obi 6.X, you can't just access the solverIndices array directly using contact.bodyA. contact.bodyA is a simplex index, not a particle index. You need to get the particle index out of that simplex. See the manual for examples on how it's done: http://obi.virtualmethodstudio.com/tutorials/scriptingcollisions.html For instance: Code: // retrieve the offset and size of the simplex in the solver.simplices array: RE: Grab Rope - VR - josemendez - 24-02-2021 Regarding the video, the only issue I can see is that the rope jumps to a different position when you grab it, probably related to the indices mismatch above. Also keep in mind that grabbing one particle will constrain the position of the rope at that point, but it will still be free to rotate around it. Ropes do not model torsion or orientation (unlike rods). You'll have to grab at least two particles if you wish to constrain its orientation. Then, there will be only one DOF left, along the rope's main axis. RE: Grab Rope - VR - tpaslou - 24-02-2021 (24-02-2021, 11:06 AM)josemendez Wrote: 'ObiSolver' does not contain a definition for 'simplexCounts' ? I use obi rope 6 RE: Grab Rope - VR - josemendez - 24-02-2021 (24-02-2021, 11:58 AM)tpaslou Wrote: 'ObiSolver' does not contain a definition for 'simplexCounts' ? I use obi rope 6 Update to latest version (6.0.1), which also fixed multiple bugs in the initial 6.X release. In 6.0 you have to manually keep track of simplex counts, which is quite inconvenient. RE: Grab Rope - VR - tpaslou - 24-02-2021 (24-02-2021, 12:14 PM)josemendez Wrote: Update to latest version (6.0.1), which also fixed multiple bugs in the initial 6.X release. In 6.0 you have to manually keep track of simplex counts, which is quite inconvenient. After a bit of experimenting the code for the grab resulted to be : Code: public void Grab() I grabbed a random index from the simplex. I used the enable-disable & follow constraint code for the Start & End particle attachment so I can pull the rope from whatever part I want and move it. There will be some future improvements. RE: Grab Rope - VR - Xanduffy - 04-03-2021 After a short hiatus I got back into the project this week and I finally updated everything to 6.0.1 and made the necessary changes to my script. However, now I'm getting issues very similar to what tpaslou showed in his video, with the rope particle seeming to snap and pin to a position far from my hand, and respond poorly to being moved or rotated. This jittering and overreaction to rotation was present before 6.0 but the position at least remained close to the player hand. I meant to post this earlier and record a video but I could do that tomorrow if it helps. Here is my current code, it's mostly the same as it was, though I may have made some mistake in updating versions: Code: { Hope you can help, does this hold the record for longest Obi forum thread yet? ![]() RE: Grab Rope - VR - Xanduffy - 04-03-2021 Here's the video of what I'm experiencing: https://vimeo.com/519484422 The jittering looks like a collider problem even though it shouldn't be pinning the particle inside, especially given where the particle seems to pin. Hopefully it's obvious when I'm grabbing the rope, as I'm in the middle of reworking the hand animations, but it should be clear that while the particle follows my hand it is nowhere near the actual position, or even the original position it was in. It gets closer as I rotate my hand, but then it jumps to the other side, still far away. |