Help Position of Solver in Hierarchy - 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 Position of Solver in Hierarchy (/thread-4141.html) |
Position of Solver in Hierarchy - vrtraining - 27-03-2024 Im using OBI Rope in Unity with XR Interaction Toolkit where user needs to grab the rope in VR and move it with hands (controllers). When Unity grabs any object it changes its position in hierarchy and move it to root, as soon as it happens OBI Rope stops working because there is no solver above in its hierarchy anymore. It only works if I put the OBI Solver directly on OBI Rope game object so when Unity moves it to root they are both moved together. I have multiple ropes in a scene, I don't want to use multiple solvers (one solver for each rope) to maintain performance. What could be a solution that I can use one solver for multiple OBI Ropes without any order in hierarchy. RE: Position of Solver in Hierarchy - josemendez - 27-03-2024 (27-03-2024, 04:32 AM)vrtraining Wrote: Im using OBI Rope in Unity with XR Interaction Toolkit where user needs to grab the rope in VR and move it with hands (controllers). Hi, You can't use XR Interaction components to grab a rope, for a very simple reason: they can only grab GameObjects and ropes aren't made of GameObjects but particles. To grab a rope, detect which particles are close to the player's hand and then override their position, you can do both using the particles API This will not only allow you to use a single solver for all ropes, but also allow you to properly grab any point along the rope. There's sample scripts included with Obi that show you how to use the API to interact with particles, for instance ObiParticlePicker/Dragger (which work by raycasting against the particles) and ObiContactGrabber (which works by grabbing particles that are in contact against a collider). kind regards, RE: Position of Solver in Hierarchy - vrtraining - 28-03-2024 (27-03-2024, 09:06 AM)josemendez Wrote: Hi, Technically I'm not grabbing the rope, I'm grabbing the hook or nozzle which is attached to the OBI Rope so I'm using static and dynamic attachments then to move the rope once nozzle or hook is grabbed. So I have a Fire Extinguisher which has a pipe using OBI Rope as its child. As soon as I grab the extinguisher or its nozzle, it moves it to the top hierarchy and can't find the solver anymore above it and stops working. If i add solver on the Rope Game Object or Fire Extinguisher then it works but in such case i will need one solver each for every extinguisher. Anyway I can use single solver without hierarchy binding? RE: Position of Solver in Hierarchy - josemendez - 28-03-2024 (28-03-2024, 05:11 AM)vrtraining Wrote: Technically I'm not grabbing the rope, I'm grabbing the hook or nozzle which is attached to the OBI Rope so I'm using static and dynamic attachments then to move the rope once nozzle or hook is grabbed. Ok then! you don't need to deal with individual particles in this case. (28-03-2024, 05:11 AM)vrtraining Wrote: So I have a Fire Extinguisher which has a pipe using OBI Rope as its child. As soon as I grab the extinguisher or its nozzle, it moves it to the top hierarchy and can't find the solver anymore above it and stops working. If i add solver on the Rope Game Object or Fire Extinguisher then it works but in such case i will need one solver each for every extinguisher. Keep in mind that having multiple solvers doesn't really affect performance, what does affect performance is having multiple updaters. Solvers updated by the same updater will be updated in parallel, same as do actors in the same solver so it's more or less the same cost. So unless you have hundreds of extinguishers (at that point the main concern is memory usage from many solvers) or you need their ropes to interact with one another, it is fine to have a single solver per extinguisher. If you still want a single solver, you can just add a ObiSolver at the top of your scene hierarchy. Actors will automatically use the first solver they find up their hierarchy, even when reparenting them at runtime. You can also use OnTransformParentChanged to add the solver yourself upon the XR interaction component reparenting the extinguisher. RE: Position of Solver in Hierarchy - ShawnF - 26-07-2024 Quote:Technically I'm not grabbing the rope, I'm grabbing the hook or nozzle which is attached to the OBI Rope so I'm using static and dynamic attachments then to move the rope once nozzle or hook is grabbed. I'm not the dev, but couldn't you just... not parent the rope to the fire extinguisher? This will be annoying organizationally since you'll likely have to rework your hose/extinguisher prefabs, but you could still have your hierarchy set up like: Solver (parent) --- Fire Extinguisher prefab - empty holder game object (child) ------ Nozzle / main extinguisher object ------ Obi rope Then when the nozzle gets moved to the top of the hierarchy, the rope will still stay where it is in the hierarchy, but the attachment will mean that it will still follow the nozzle as intended. And you'll still have the chance to have prefabs set up that already have your nice fire extinguishers pre-arranged the way you want them. Since the rope doesn't have to be a direct child of the solver, something like this should work. |