I'm using the ObiFluid to simulate liquid pooling and I would like to know when all the particles have stopped moving so I can 'freeze' the simulation on the ObjEmitter since it won't be interacted with anymore once all particles have stopped.
I noticed that if I manually disable the Obi Emitter modifier I see the framerate recover but otherwise, even if the particles aren't moving anymore, it seems to still be calculating.
Is there a way to check if all particles of a specific Obi Emitter are sleeping and disable it?
I want to later come back here and say 'move constraint 0'. The "SourcePosition" property here will always provide the correct desired position in world space.
I thought maybe I could do something like this, but nothing seems to happen when I call it:
Hi, my intention is making grappling hook effect. But not like in the examples. My rope is already initialized on scene. What I want to do when I press the mouse button it scales up to object's position, then pinned to the object and stay on this length.
I've been struggling with optimizing my ropes for quite some time now and tried all of the recommended solutions I've been able to find in the forums.
But for some reason, I can't get the ObiFixedUpdater under control.
This application is built for Oculus Quest and runs perfectly at 72 frames when no Obi Solvers are enabled (but meshed ropes are rendered).
Using Fixed Updater, 1 substep - no unity physics substep (even though I have a single two-way dynamic attachment). Fixed and max timestep locked together: 0.02 and 0.06. (both tested results below) Total Particles: 18 Smoothing: 0 Segment: 4
Unchecked all unnecessary constraints on the solver, and only have 1 iteration on everything (except 2 on parallel collisions).
I should mention I also have a 3 particle antenna (rod) with some smoothing, but that has a negligible performance impact according to my testing.
I'm getting around 50-60 frames when I activate the rope's solver, but when running the profiler directly on the Oculus Quest I notice a big performance variation.
As you can see below some of the worst cases are around 10-12ms, while others are as low as 3 ms.
Timestep 0.02 - 11.48ms: Timestep 0.02 - 3.05ms:
Timestep 0.06 - 9.14ms:
Timestep 0.06 - 1.44ms:
It doesn't seem like this is the timestep death spiral, or v-sync (which is forced off).
So my question is simply;
Is this expected behavior? If not, what can I do to improve my performance?
I just bought this asset and the grappling hook demo provided seems like a good starting point for me. However my project is 2D so I'm using Rigidbody2Ds, ObiCollider2Ds, and so on.
After some wrangling I got to a point where I can spawn a rope just like in the demo. However the "2D" rope has a number of issues. It often causes my player to oscillate rapidly (which I fixed by increasing angular drag a lot, obviously not a great solution), the rope sometimes curls into the z axis for no clear reason (it's not running out of space or anything) despite absolutely none of the vectors I'm using having any z component. Often the resulting rope is just significantly longer than expected.
I more or less just copied the code from the grappling hook demo for my "attach hook method":
// Create both the rope and the solver:
m_ropeRenderer = gameObject.AddComponent<ObiRopeLineRenderer>();
//m_ropeRenderer.section = m_section;
m_ropeRenderer.uvScale = new Vector2(1, 5);
m_ropeRenderer.normalizeV = false;
m_ropeRenderer.uvAnchor = 1;
// Generate the particle representation of the rope (wait until it has finished):
yield return m_ropeBlueprint.Generate();
Debug.Break();
// Pin both ends of the rope (this enables two-way interaction between character and rope):
var pinConstraints = m_ropeBlueprint.GetConstraintsByType(Oni.ConstraintType.Pin) as ObiConstraints<ObiPinConstraintsBatch>;
var batch = pinConstraints.batches[0];
batch.AddConstraint(0, m_characterCollider, transform.localPosition, Quaternion.identity);
batch.AddConstraint(m_ropeBlueprint.activeParticleCount - 1, hitCollider.GetComponent<ObiColliderBase>(),
hitCollider.transform.InverseTransformPoint(worldSpacePoint), Quaternion.identity);
batch.activeConstraintCount = 2;
// Set the blueprint (this adds particles/constraints to the solver and starts simulating them).
m_rope.ropeBlueprint = m_ropeBlueprint;
m_rope.GetComponent<MeshRenderer>().enabled = true;
}
Note the addition of a Debug.Break() so I can examine the ObiRope in the scene view immediately after it's created.
So here's the result of me targeting a point in the level and trigger the above code. Looks good to me. Expected result: a rope is spawned matching the line exactly and then the rigidbody2d swings into the right wall.
The actual resulting rope starts looking correctly but then ends up being long enough for the rigidbody to continue falling and hit the ground. It's also oscillating between about -30 and 30 degrees every frame.
It's obvious I'm doing something wrong. Possibly parameters on the rope I'm not setting correctly, or maybe the tangents/normals when I set the initial path. Any tips? I could provide the scene if needed.
EDIT: Changing the solver mode to 'Mode 2D' improved it slightly but I'm still getting the oscillations and longer than expected ropes.
Hey, so I think I've managed to improve it a lot by imposing rotation constaints on the rigidbody and increasing the amount of substeps on the updater. It's working a lot more like what I need now!
Viz the attached image, the whole lower part of the cloth has the same particle properties yet only the small par seems to be getting simulated for some reason. All the rest is just stiff and moving as a group together.
What could be the issue here? Does seem like there is a limit of particles. I don't even care that it is getting through the mesh I just want to get it simulated first.
I've been attempting to build my project using Unity Cloud Build and it would seem the object files included in the latest package are incompatible with the newest XCode in cloud build? I get the following error:
Code:
/Libraries/Obi/Plugins/iOS/libOni.a(Oni.o), could not parse object file ------redacted------/Libraries/Obi/Plugins/iOS/libOni.a(Oni.o): 'Invalid bitcode version (Producer: '1103.0.32.29.0_0' Reader: '1100.0.33.17_0')', using libLTO version 'LLVM version 11.0.0, (clang-1100.0.33.17)' for architecture arm64
68: ▸ ❌; clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is my thinking correct? If so, what version of XCode, etc. should I be using?
Thanks!
(13-04-2020, 01:48 AM)dylanrw Wrote: I've been attempting to build my project using Unity Cloud Build and it would seem the object files included in the latest package are incompatible with the newest XCode in cloud build? I get the following error:
Code:
/Libraries/Obi/Plugins/iOS/libOni.a(Oni.o), could not parse object file ------redacted------/Libraries/Obi/Plugins/iOS/libOni.a(Oni.o): 'Invalid bitcode version (Producer: '1103.0.32.29.0_0' Reader: '1100.0.33.17_0')', using libLTO version 'LLVM version 11.0.0, (clang-1100.0.33.17)' for architecture arm64
68: ▸ ❌; clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is my thinking correct? If so, what version of XCode, etc. should I be using?
Thanks!
It looks to me like you built this using Xcode 11.4, while Cloud Build only supports up to 11.3.1.
I have implemented a rope I need to stretch the rope at a point like I did in this given linked video https://1drv.ms/v/s!AkGarI_8WKB3hmOFK6hS12V4zMap
I used a collider to drag a rope but at fast speed the collider passes through it often and more over I need to stretch it the same way upward so kindly suggest me the way to do this perfectly without using collider.
I've noticed a really prominent stutter that can be traced to the Obi fixed updater. It's irregular but frequent. The execution time of the fixed update method runs up to 32ms during these spikes.
This occurs even in a completely empty scene with one solver and one rope, with only roughly 50 particles (see particle renderer in the image for particle density). The solver is set to default settings. The updater is also at default settings, with SubstepUnityPhysics set to false, and the blueprint is simply two points, with each control point attached via a static attachment point to gameobjects in the scene.This is about the simplest setup I can imagine for a rope. So i would expect that it would run smoothly on a fast desktop machine.
Unity physics and timestep settings are all set to default, and these cpu spikes are visible both when running in the editor and a standalone windows build.
Is there anything you can suggest to help get rid of this?