Help Ropes // Couple of questions - 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 Ropes // Couple of questions (/thread-3857.html) |
Ropes // Couple of questions - 5G_Zendmast - 04-05-2023 Hi! We are more and more getting comfortable using ObiRope in our projects and we are learning something new every time. This also means that we get stuck again on certain points and I would like to ask for some help To set the scene: - We have a cable that comes from a reel on a vessel - The cable extends and goes in the water - Once the cable is extended and at the ocean floor we need to attach the cable to an object on the floor - This attachement point is not the beginning/end and is not a pre-determined location I figured out with the documentation how to extend the cable to make it seem like its extending from a reel. This looks very nice and works perfectly! The next part that I'm stuck at is attaching the the cable to an object. Usually I would: - Make a rope blueprint - Add controlpoint - Add ObiAttachement component - Attach an object to the Attachment component and assign the correct controlpoint - Animate the objects transform to then also animate the cable behaviour at that point. Though, in this case the situation is different as there is no rope blueprint with fixed controlpoints. I can see in the documentation that you can add attachments during runtime but I don't quite understand how to do this. I would think we need to know the following: - Which element has the particles that we want to control - Add a ObiAttachment - Assign an object to the ObiAttachment I'm no pro in scripting unfortunately and this is where I'm getting stuck. I wanted to visualize the particles to get an idea of how the particles are positioned during runtime but the ObiParticleRenderer component doesn't seem to work and I can't seem to get it to work in any of the demo scenes either. Am I missing something obvious here? I'm using Unity2022 HDRP, and the Render checkbox is ticked in the component. I have two screenshots attached to this post. Hopefully my question makes sense Thanks in advance! Kind regards RE: Ropes // Couple of questions - josemendez - 11-05-2023 (04-05-2023, 10:05 AM)5G_Zendmast Wrote: The next part that I'm stuck at is attaching the the cable to an object. Hi! You can create particle groups at runtime, in addition to the ones automatically created when generating the blueprint (one per control point). The manual shows some sample code to do this: Code: var group = ScriptableObject.CreateInstance<ObiParticleGroup>(); let me know if you need further help, kind regards RE: Ropes // Couple of questions - 5G_Zendmast - 16-05-2023 (11-05-2023, 10:22 AM)josemendez Wrote: Hi! Hi Jose, Thanks for your reply. With your information I got it to work with the following code. Do you maybe see anything that might cause a problem or that i'm using in a wrong way? Code: void AddControllPoint(int index) Besides this I'm still wondering if you could help me with how to visualize the particles. The only way I get to see the particles is when using ObiInstancedParticleRenderer and disabeling the mesh renderer of the rope. Is that the only way to visualize the particles or am I missing something in the ObiParticleRenderer component? Thanks again for your help and I'm a step closer once again Kind regards, Patrick EDIT: I think I cheered a bit to early haha. The script seems to work perfectly for a rope that keeps its original blueprint (first attachment). But after I extended the rope during runtime and I want to add a attachment the object goes to the correct transform (at least it acts the way I expect it to act) but the particle it's attached to seems to be off (or the other way around) In the 2nd attachment you can see the cube is placed somewhere along the rope but when I move the cube around it's attached to the wrong (?) particle. Yesterday I only tested it with the original blueprint and not after the rope is extended during runtime. Does this maybe have to do with the allocation of particles during runtime? (http://obi.virtualmethodstudio.com/manual/6.3/scriptingropes.html) |