Posts: 42
Threads: 7
Joined: May 2025
Reputation:
0
03-07-2025, 10:29 AM
Hello,
I'm working on creating a rope whose length is controlled by an ObiCursor. When the player grabs the rope using a pinhole, the pinhole's position doesn't seem to follow the rope at all as its length changes. Is there a way to make the pinhole stays in the right position relative to the rope length?
Kind regards,
Posts: 6,546
Threads: 27
Joined: Jun 2017
Reputation:
427
Obi Owner:
(03-07-2025, 10:29 AM)quent_1982 Wrote: Hello,
I'm working on creating a rope whose length is controlled by an ObiCursor. When the player grabs the rope using a pinhole, the pinhole's position doesn't seem to follow the rope at all as its length changes. Is there a way to make the pinhole stays in the right position relative to the rope length?
Kind regards,
Hi!
You can set the position along the rope using pinhole.position. This is a normalized coordinate that runs from 0 (start of the rope) to 1 (end of the rope).
See the VineClimbController sample script used in the VineSwinging sample scene, it sets the pinhole position to attach the character to a new position along the vine.
kind regards,
Posts: 42
Threads: 7
Joined: May 2025
Reputation:
0
04-07-2025, 11:29 AM
(This post was last modified: 06-07-2025, 06:21 AM by quent_1982.)
(04-07-2025, 09:46 AM)josemendez Wrote: Hi!
You can set the position along the rope using pinhole.position. This is a normalized coordinate that runs from 0 (start of the rope) to 1 (end of the rope).
See the VineClimbController sample script used in the VineSwinging sample scene, it sets the pinhole position to attach the character to a new position along the vine.
kind regards,
Hello,
Let me be more specific, I've already implement VineSwinging example to my player, except the change position because I do not need it in a sample's way.
So when the grabbed rope length is overridden by ObiCursor and ObiCursor is changing the rope's length, the position on the pinhole is not changing with rope length, that causing bugs when ObiPinhole is reach value that doesn't contains rope anymore. So is there a way to set ObiPinhole position dynamically without visual bugs or even physical bugs related to ObiCursor length changing?
P.S. I tried using _pinhole.CalculateMu(), but it returns the position as a percentage of the rope's length, which doesn't work for my use case. I need to grab a specific position on the rope and update it dynamically so that the visual position remains consistent rather than depended on percent of length.
Kind regards,
Posts: 6,546
Threads: 27
Joined: Jun 2017
Reputation:
427
Obi Owner:
(04-07-2025, 11:29 AM)quent_1982 Wrote: P.S. I tried using _pinhole.CalculateMu(), but it returns the position as a percentage of the rope's length, which doesn't work for my use case. I need to grab a specific position on the rope and update it dynamically so that the visual position remains consistent rather than depended on percent of length.
Kind regards,
The only way to specify the position of a pinhole is using a length %. However you can easily calculate the length % of any point or element in the rope yourself, it's just a division by the total amount of elements.
kind regards,
Posts: 42
Threads: 7
Joined: May 2025
Reputation:
0
07-07-2025, 03:48 PM
(This post was last modified: 07-07-2025, 03:49 PM by quent_1982.)
(07-07-2025, 08:13 AM)josemendez Wrote: The only way to specify the position of a pinhole is using a length %. However you can easily calculate the length % of any point or element in the rope yourself, it's just a division by the total amount of elements.
kind regards,
Hello, thanks but I've recently noticed a new problem.
I'm using ObiRope and need to restart ropes during the game. Right now, I destroy and instantiate them using Unity’s Destroy() and Instantiate(), but after around 20 restarts, performance drops from 100+ FPS to 1 FPS — likely due to garbage collection or no proper Burst and Jobs disposing.
I also tried using _solver. RemoveActor() and _solver. AddActor(), but even when doing that before destroying/instantiating, I still get same performance leaks.
Is there a proper way to restart ObiRopes without causing these issues?
Kind regards,
Posts: 6,546
Threads: 27
Joined: Jun 2017
Reputation:
427
Obi Owner:
07-07-2025, 04:16 PM
(This post was last modified: 07-07-2025, 04:17 PM by josemendez.)
(07-07-2025, 03:48 PM)quent_1982 Wrote: Hello, thanks but I've recently noticed a new problem.
I'm using ObiRope and need to restart ropes during the game. Right now, I destroy and instantiate them using Unity’s Destroy() and Instantiate(), but after around 20 restarts, performance drops from 100+ FPS to 1 FPS — likely due to garbage collection or no proper Burst and Jobs disposing.
Hi!
It's simply not possible for garbage collection or memory leaks to cause such a performance drop - unless a large amount of garbage needs to be collected every frame, or there's a leak is so large it causes the device to run out of RAM, jeopardizing further memory allocation.
My advice would be to check what's actually causing this by using the profiler, the reason for such a large performance drop should be apparent immediately upon opening it. If you share your profiling session, I can help you interpret the profiling info.
kind regards
Posts: 42
Threads: 7
Joined: May 2025
Reputation:
0
(07-07-2025, 04:16 PM)josemendez Wrote: Hi!
It's simply not possible for garbage collection or memory leaks to cause such a performance drop - unless a large amount of garbage needs to be collected every frame, or there's a leak is so large it causes the device to run out of RAM, jeopardizing further memory allocation.
My advice would be to check what's actually causing this by using the profiler, the reason for such a large performance drop should be apparent immediately upon opening it. If you share your profiling session, I can help you interpret the profiling info.
kind regards
At this moment I've already solved the issue: in my case helped simply respawn solver. So thanks for quick reply, now I think all is good!
Kind regards,
|