Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making a Leash
#1
Hey everyone!

I'm interested in making a dog leash for our current project, so a person can move around and the rope would apply a force to a dog.
Would it be possible to do something like this in Obi Rope? If so, ho would I be able to achieve the desired effect?

Obi Rope seems like a solid solution, but I wanna know if I can make the leash with it before spending my money on the asset.

Thanks in advance!
Reply
#2
(08-11-2019, 05:28 PM)jpalz Wrote: Hey everyone!

I'm interested in making a dog leash for our current project, so a person can move around and the rope would apply a force to a dog.
Would it be possible to do something like this in Obi Rope? If so, ho would I be able to achieve the desired effect?

Obi Rope seems like a solid solution, but I wanna know if I can make the leash with it before spending my money on the asset.

Thanks in advance!

Hi there,

Should be pretty easy to do. All you need to use are pin constraints to achieve two-way coupling between the dog and the leash. That is, the dog would be able to pull the leash, and the least would be able to resist this pulling force.

See:
http://obi.virtualmethodstudio.com/tutor...aints.html
Reply
#3
(08-11-2019, 06:25 PM)josemendez Wrote: Hi there,

Should be pretty easy to do. All you need to use are pin constraints to achieve two-way coupling between the dog and the leash. That is, the dog would be able to pull the leash, and the least would be able to resist this pulling force.

See:
http://obi.virtualmethodstudio.com/tutor...aints.html

Cool, I'll try that. Thanks!!  Gran sonrisa
Reply
#4
OK, I bought Obi Rope, created a rope at first using the ObiRopeExtrudedRenderer (made by selecting GameObject -> 3D Object -> Obi Rope fully set up). 
The rope is 3m long, rendered using 52 particles, and with one pin constraint at the beginning and end particle, so the leash is connected to the human and the dog. So far, so good.
And then I hit Play...

I noticed immediately that there's a performance drop which is super noticeable. Profiling the game, I find the following:
[attachment=460]

For some reason, there are two FixedUpdates and two WaitForAllSolvers.

Changing the renderer to the ObiRopeLineRenderer improved the framerate, but there were still noticeable spikes, seeing something like this:
[attachment=461]

What can I do to improve the framerate? My guess is that it starts by changing the FixedUpdate to only one call. I've tried increasing the Fixed Timestep to 0.04, but there are still occasional hitches.

Thanks!
Reply
#5
(08-11-2019, 09:07 PM)jpalz Wrote: OK, I bought Obi Rope, created a rope at first using the ObiRopeExtrudedRenderer (made by selecting GameObject -> 3D Object -> Obi Rope fully set up). 
The rope is 3m long, rendered using 52 particles, and with one pin constraint at the beginning and end particle, so the leash is connected to the human and the dog. So far, so good.
And then I hit Play...

I noticed immediately that there's a performance drop which is super noticeable. Profiling the game, I find the following:


For some reason, there are two FixedUpdates and two WaitForAllSolvers.

Changing the renderer to the ObiRopeLineRenderer improved the framerate, but there were still noticeable spikes, seeing something like this:


What can I do to improve the framerate? My guess is that it starts by changing the FixedUpdate to only one call. I've tried increasing the Fixed Timestep to 0.04, but there are still occasional hitches.

Thanks!

Hi,

Deep profiling will cause any game to run 70-80% slower than it usually would, which can (usually will) trigger death spiraling.(*) Excerpt from Unity's manual:
https://docs.unity3d.com/Manual/Profiler...-profiling

Quote:When you enable the Deep Profile setting, the Profiler profiles every part of your script code and records all function calls, including at least the first call stack depth into any Unity API. This is useful information to help you work out where your code impacts on your application’s performance, but it comes with a large overhead.

So disable the profiler entirely. If you have performance issues, profile using the normal profiler. If you still can't figure out what's happening, then use deep profiling to get a sense of relative (not absolute!) performance between function calls.


(*)This is a situation where each frame takes a lot of time to be completed, which increases the amount of time to be simulated by physics, increasing the amount of fixed updates needed per frame, which in turn causes the next frame to take even longer to complete...in a downwards spiral that ends when a frame takes less time to process than the amount of "wall-clock" time it simulates, or when you hit the maximum fixed timestep. If you're having this issue, reducing the maximum fixed timestep or increasing the timestep are viable solutions.
Reply
#6
(09-11-2019, 08:30 AM)josemendez Wrote: Hi,

Deep profiling will cause any game to run 70-80% slower than it usually would, which can (usually will) trigger death spiraling.(*) Excerpt from Unity's manual:
https://docs.unity3d.com/Manual/Profiler...-profiling


So disable the profiler entirely. If you have performance issues, profile using the normal profiler. If you still can't figure out what's happening, then use deep profiling to get a sense of relative (not absolute!) performance between function calls.


(*)This is a situation where each frame takes a lot of time to be completed, which increases the amount of time to be simulated by physics, increasing the amount of fixed updates needed per frame, which in turn causes the next frame to take even longer to complete...in a downwards spiral that ends when a frame takes less time to process than the amount of "wall-clock" time it simulates, or when you hit the maximum fixed timestep. If you're having this issue, reducing the maximum fixed timestep or increasing the timestep are viable solutions.

Hey Jose,
Naturally it will run slower with the deep profiler, but these stutters happen all the time, even with no ropes on the scene and an object with an ObiSolver component active.
Below is a screenshot of the spike with the default profiler:
[attachment=462]

Disabling the ObiSolver while no ropes are on the scene makes the game run smooth again, but I start seeing these spikes whenever I re-enable it. The leash created is between the player, which has a phase value of 1, and a ball which has a phase value of 2.
Do you have any other suggestions to improve framerate besides increasing the timestep or reducing the maximum fixed timestep?
Thanks!
Reply
#7
(11-11-2019, 05:37 PM)jpalz Wrote: Hey Jose,
Naturally it will run slower with the deep profiler, but these stutters happen all the time, even with no ropes on the scene and an object with an ObiSolver component active.
Below is a screenshot of the spike with the default profiler:


Disabling the ObiSolver while no ropes are on the scene makes the game run smooth again, but I start seeing these spikes whenever I re-enable it. The leash created is between the player, which has a phase value of 1, and a ball which has a phase value of 2.
Do you have any other suggestions to improve framerate besides increasing the timestep or reducing the maximum fixed timestep?
Thanks!

Hi,

Strange, I'm unable to reproduce any spikes :/. With no ropes in it (thus no active particles), the solver basically does nothing at all. May I see the hierarchy view in your profiler?

Edit:
Here's the tests I performed in a fresh project, using Obi downloaded from the store. Added a new solver to the scene, no spikes at all, performance is exactly the same as with no solvers in the scene. Adding a single 1 meter rope, simulation takes 0.28 ms (multithreaded, 2 cores) and rendering 0.6 ms (single threaded). If you're not getting similar results, there's either some issue in your project or some bug in Obi. Taking a look at where those +60 ms are being spent during the spikes might shed some light!
Reply
#8
(11-11-2019, 06:01 PM)josemendez Wrote: Hi,

Strange, I'm unable to reproduce any spikes :/. With no ropes in it (thus no active particles), the solver basically does nothing at all. May I see the hierarchy view in your profiler?

Edit:
Here's the tests I performed in a fresh project, using Obi downloaded from the store. Added a new solver to the scene, no spikes at all, performance is exactly the same as with no solvers in the scene. Adding a single 1 meter rope, simulation takes 0.28 ms (multithreaded, 2 cores) and rendering 0.6 ms (single threaded). If you're not getting similar results, there's either some issue in your project or some bug in Obi. Taking a look at where those +60 ms are being spent during the spikes might shed some light!

Here's the hierarchy of the project:
[attachment=463]

LeashManager is the object that has the ObiSolver component. Player, Rope Stuff and Collision Plane have ObiColliders and ObiRigidbodies.

I made a new scene, with a Main Camera and a Directional Light, and placed the ObiSolver on the Camera. I got these results on the profiler:
[attachment=464]

EDIT: There are no ropes in the new scene. I'm using 2019.2.0f1 x64
Reply
#9
(11-11-2019, 07:47 PM)jpalz Wrote: Here's the hierarchy of the project:


LeashManager is the object that has the ObiSolver component. Player, Rope Stuff and Collision Plane have ObiColliders and ObiRigidbodies.

I made a new scene, with a Main Camera and a Directional Light, and placed the ObiSolver on the Camera. I got these results on the profiler:


EDIT: There are no ropes in the new scene. I'm using 2019.2.0f1 x64

Hi,

I meant the hierarchy view in the profiler, not the scene hierarchy Sonrisa. This is to be able to see what is happening during these spikes, because my results are completely different (2019.2.9f1 x64)
Reply