Help Use obi rope to generate player lines - 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 Use obi rope to generate player lines (/thread-4168.html) |
Use obi rope to generate player lines - Jack Li - 11-04-2024 I am currently working on a small fishing game using Obi Rope and seeking some advice. Inspired by the RopeGrapplingHook, I'm creating a rope based on the player's lines. My approach involves continuously altering 'cursorMu' between 0.1 and 0.9, along with adjusting 'ChangeLength', to achieve consistent contraction of the rope from both ends. However, I'm encountering a significant challenge: the rope vibrates intensely and behaves unpredictably during generation. I've used a custom outline from a sprite to create a mesh collider. I need to reel in the fish slowly, just like it's shown in the video. If I don't, the fish ends up slipping through the collider of the rope.Could anyone offer insights or suggestions on how to optimize and address this issue? Thanks in advance for your help! here is my game video: RE: Use obi rope to generate player lines - josemendez - 11-04-2024 Hi! Could you share the code you're using to alternate the position of the cursor? Since your rope has no visible texture/pattern on it, contracting it from just one side should yield visually similar results. Is there any particular reason why this doesn't work for your use case? kind regards, RE: Use obi rope to generate player lines - Jack Li - 11-04-2024 Hi josemendez, Thanks for your reply! Here is the code about generating the rope and changing the cursor~ Why is the rope not generated for the points in m_Positions? I also want to take a ray starting from the fish and check the number of times the ray passes through the rope to check whether the object is surrounded by the rope, but Query methods don't seem to be able to do it. Code: private async UniTaskVoid ChangeRopeLength1() I need to create an effect similar to the one in the video: RE: Use obi rope to generate player lines - josemendez - 15-04-2024 (11-04-2024, 05:17 PM)Jack Li Wrote: Here is the code about generating the rope and changing the cursor~ Why is the rope not generated for the points in m_Positions? What's m_Positions? The code looks like you're trying to generate a rope that passes trough a set of points, but that's precisely what the blueprint is designed for: providing a path that passes trough several control points, and generate a rope out of them. If that's your goal, there isn't any need to loop over m_Positions increasing the length of the rope and manually placing particles yourself. Just create one control point per point in m_Positions. (11-04-2024, 05:17 PM)Jack Li Wrote: I also want to take a ray starting from the fish and check the number of times the ray passes through the rope to check whether the object is surrounded by the rope, but Query methods don't seem to be able to do it. No need to use raycast queries for this, there's a much simpler way: just iterate trough all elements in the rope -since they can be considered faces of a polygon- and perform a basic point-in-polygon test like this one: https://wrfranklin.org/Research/Short_Notes/pnpoly.html About your original issue with the rope jittering, I'm afraid that's unavoidable given your approach: every frame you're removing rope from a different part of it, so the mass distribution at both ends of the rope will change every frame leading to a small jitter. You could increase the solver's sleep threshold slightly, see if that can hide this jitter without affecting rope dynamics too much. kind regards |