Help Grab Obi Rope with Playmaker & 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 Obi Rope with Playmaker & VR (/thread-2520.html) |
Grab Obi Rope with Playmaker & VR - NinjaPlayground - 03-10-2020 I've searched the forum with no luck with anyone being able to grab the middle of an obi rope with Playmaker or with VR. I've found scripts (ObiContactGrabber.cs) to grab any particle automatically using Grab & Release functions, but this can't exactly be used well with Playmaker without some additional modifications and I am not a programmer. While I understand Obi Rope isn't designed with Playmaker in mind, you can usually use Playmaker to access any publicly exposed variables, bools, methods, properties, etc. in order to get most things to work. My largest problem is trying to detect collisions with the ObiSolver. Grabbing the ends of a rope is no problem because that doesn't rely collisions with the ObiSolver, but that doesn't allow me to climb a rope. While I've tried to adapt the ObiContactGrabber script to add bools to allow me to detect if a collision has been made with an ObiSolver this doesn't allow me to do a few things:
So I need help or minor programming tips on how to expose some things in order for me to be able to use Playmaker. I need to be able to expose functions or variables to achieve this and would rather try to use ObiRope due to its efficiency as opposed to using a heavier rope solution from the Unity Asset Store. EDIT: So I've managed to grab the mid point of a ObiRope using the ObiContactGrabber script by simply connecting the Grab & Release functions to the "Grabbing" of an Oculus Controller. Which by default only grabs when the collision with the ObiSolver is happening. My only problem now is getting access to which ObiSolver is colliding with the ObiContactGrabber script AND a bool letting me know that the collision IS TRUE. I can use this bool as a switch to make sure I can trigger the vertical climbing when the ObiCollider is actually in contact with the ObiSolver particles. EDIT: Managed to add a bool collision check in the "ObiSolver.cs". Allows me to check if collision is happening on the particle. I can now climb an obi rope in VR & Playmaker. Would still love to hear any thoughts on how to do this better or in a different way. RE: Grab Obi Rope with Playmaker & VR - josemendez - 05-10-2020 Hi! If you need to use multiple solvers instead of just one, you can subscribe to multiple solvers' OnCollision event instead of just one. Minor modifications are needed in the example ObiContactGrabber.cs script: - Declare ObiSolver[] (solver)instead of a ObiSolver. - Declare a Dictionary<ObiSolver,ObiSolver.ObiCollisionEventArgs> collisionEvents to map each solver to its collision event. - Add a ObiSolver field in the GrabbedParticle inner class, so each particle solver which solver it belongs to. - Iterate over solvers/collisionEvents where needed, instead of accessing a single solver/collisionEvent. A boolean flag indicating if there's anything grabbed can be added by simply checking whether the list of grabbed actors contains at least 1 actor. Find the modified ObiContactGrabber.cs script attached this post. If you'd rather know if there's any collision, regardless of the grabber actually grabbing an actor, just subscribe to the OnCollision event and turn a bool value true if there's any non-speculative contact in the list: Code: // declare a collision bool at the top of your class: No need to modify any core components, such as ObiSolver. Note that Obi assumes not only programming skills, but also familiarity with basic physics simulation concepts (timestep, forces, impulses, masses, etc). These aren't explained in detail anywhere in the documentation, so if you're uncomfortable with these using Obi will present a steep learning curve. |