Obi Official Forum

Full Version: Use to simulate a hose in 3thr person
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, i have a question.

I am creating a farming game and i want to add the posibility to character get equiped with a hose, there is posible to simulate this with ubi rope?

y tried the demos included in the asset, but i don't know  wicth can help to do that

can you guide me?


Thanks


Claudio
(14-06-2022, 09:19 PM)claudius Wrote: [ -> ]Hello, i have a question.

I am creating a farming game and i want to add the posibility to character get equiped with a hose, there is posible to simulate this with ubi rope?

y tried the demos included in the asset, but i don't know  wicth can help to do that

can you guide me?


Thanks


Claudio

Hi Claudio,

Chances are you can do this with ObiRope, however "getting equipped with a hose" doesn't really describe anything about the use case: what's this hose used for? should it interact with other objects besides the character? in what way? is it attached to anything? should it be possible to change its length at runtime? does it have a maximum length? should it be able to restrict character movement? etc.

Most of the included demos focus on one aspect of rope simulation in particular: rope collisions, dynamically changing length, tearing/cutting, attachments, bending, torsion, etc. I'd take a look at the manual to get a feel of everything that's possible with Obi:

http://obi.virtualmethodstudio.com/manual/6.3/

kind regards,
Hello. The hose is like this





In the begining there isn't a hose (there is hidden or maybe is very small).

after the character interact with then and get equiped, the hose grow up and have a limit (10 meters).

should it be possible to change its length at runtime?
yes.

does it have a maximum length?
yes, maybe 10 meters

should it be able to restrict character movement?

yes, when it reached the maximum length of the hose


Do you have any advice?

Thanks

Claudio
(15-06-2022, 11:26 PM)claudius Wrote: [ -> ]Do you have any advice?

Thanks

Claudio

Other than that you must use a non kinematic rigidbody-based character controller (so that the rope can "pull" from the character to restrict its movement once it's reached its maximum length), not really. Should be pretty straightforward thing to do: just add an attachment to the character's hand at one end and use a cursor to change the rope's rest length.

Also, try to keep rope resolution as low as you can get away with, and use multiple substeps if the rope looks too elastic.

let me know if I can be of any help,
(14-06-2022, 09:19 PM)claudius Wrote: [ -> ]Hello, i have a question.

I am creating a farming game and i want to add the posibility to character get equiped with a hose, there is posible to simulate this with ubi rope?

y tried the demos included in the asset, but i don't know  wicth can help to do that

can you guide me?


Thanks


Claudio

Hi Claudio,
I am writing because I have a similar problem / use case, trying to make a firefighting simulation involving hoses. Did you find a solution in the meantime? If yes, would you mind sharing your experience? If not: should we joint efforst to get to proper hose simulation so we will not need to do the work twice?
Best wishes,
Marie
(30-10-2022, 08:15 PM)MarieGrasmeier Wrote: [ -> ]Hi Claudio,
I am writing because I have a similar problem / use case, trying to make a firefighting simulation involving hoses. Did you find a solution in the meantime? If yes, would you mind sharing your experience? If not: should we joint efforst to get to proper hose simulation so we will not need to do the work twice?
Best wishes,
Marie

Hi, not op, but I've done something with a lot of similarity in my project. Where ropes are connected to rigidbodies, and the player can 'pick up' one end of the rope, and drag it around the scene, attaching to objects and towing/manipulating any connected bodies.

The basic setup to this involves the following:

At either end of the rope (though in your case likely only the 'nozzle' end would need this) there is an object with rigidbody, collider, obi rigidbody, obi collider. This is the object the player will interact with.

Between this object(s) and the source of the rope, I add the rope. This is created along the standard tutorial means. Each end will be connected to the interaction objects (nozzle, spool) with an Obi particle attachment point, make sure the source is aligned to the correct point on the spline or things will get interesting. If the end is to be interacted with, you will need at least this ends particle attachment point to be dynamic. You will likely also want an Obi Cursor on the rope to programmatically handle unwinding/winding of the rope.

Lastly the player is a rigidbody that can 'pick up' any of the ends and perform any functions supplied to that rigidbody. The rope itself is basically along for the ride at that point. Just make sure the motions of both the player and the held object are handled through forces rather than directly set, otherwise things will get really floppy and stretchy.
(31-10-2022, 02:16 PM)MEPETAMINALS Wrote: [ -> ]Hi, not op, but I've done something with a lot of similarity in my project. Where ropes are connected to rigidbodies, and the player can 'pick up' one end of the rope, and drag it around the scene, attaching to objects and towing/manipulating any connected bodies.

The basic setup to this involves the following:

At either end of the rope (though in your case likely only the 'nozzle' end would need this) there is an object with rigidbody, collider, obi rigidbody, obi collider. This is the object the player will interact with.

Between this object(s) and the source of the rope, I add the rope. This is created along the standard tutorial means. Each end will be connected to the interaction objects (nozzle, spool) with an Obi particle attachment point, make sure the source is aligned to the correct point on the spline or things will get interesting. If the end is to be interacted with, you will need at least this ends particle attachment point to be dynamic. You will likely also want an Obi Cursor on the rope to programmatically handle unwinding/winding of the rope.

Lastly the player is a rigidbody that can 'pick up' any of the ends and perform any functions supplied to that rigidbody. The rope itself is basically along for the ride at that point. Just make sure the motions of both the player and the held object are handled through forces rather than directly set, otherwise things will get really floppy and stretchy.

Hi Claudio,
thank you so much for the detailed answer.
The player controller rigidbody thing will still be exciting :-) Currently I use the Unity Starter Asset First Person Controller which is not physical. Looks like I will need to make my own controllers anyway at some point, also for other reasons. But not sure if it is a good idea to make the player a rididbody in general (could cause more trouble than it solves). We will see.
Otherwise, I will investigate in the possibility to somehow get the tension of the rope via code and disable player movement in the repsective direction when the hose is tight.
(31-10-2022, 03:42 PM)MarieGrasmeier Wrote: [ -> ]Hi Claudio,
thank you so much for the detailed answer.
The player controller rigidbody thing will still be exciting :-) Currently I use the Unity Starter Asset First Person Controller which is not physical. Looks like I will need to make my own controllers anyway at some point, also for other reasons. But not sure if it is a good idea to make the player a rididbody in general (could cause more trouble than it solves). We will see.
Otherwise, I will investigate in the possibility to somehow get the tension of the rope via code and disable player movement in the repsective direction when the hose is tight.

If you are averse to the character being a rigidbody, you should still be able to use a similar method, it will just increase the importance of the rigidbody that the rope connects to. (The 'nozzle') Just be careful when linking the non-rigidbody motions of the player to the rigidbody of the rope/rope interaction. They are designed to be moved via forces rather than set directly, and attempting to do so will cause a lot of jittery/bouncy/weird motions. Maybe write some code that moves the 'held' end of the rope/hose to a position near the player via physics forces kinda like the held objects in skyrim or something.