Search Forums

(Advanced Search)

Latest Threads
Stretching verts uniforml...
Forum: Obi Softbody
Last Post: josemendez
Yesterday, 04:32 PM
» Replies: 1
» Views: 179
Scripting rod forces
Forum: Obi Rope
Last Post: chenji
11-09-2025, 01:15 PM
» Replies: 25
» Views: 3,060
Burst error causing crash...
Forum: Obi Rope
Last Post: josemendez
10-09-2025, 07:03 AM
» Replies: 1
» Views: 270
Controlling speed of emit...
Forum: Obi Fluid
Last Post: josemendez
06-09-2025, 06:29 AM
» Replies: 1
» Views: 541
Looks nice on editor but ...
Forum: Obi Fluid
Last Post: josemendez
04-09-2025, 07:20 AM
» Replies: 3
» Views: 787
How to Shorten or Scale t...
Forum: Obi Rope
Last Post: josemendez
02-09-2025, 09:53 AM
» Replies: 5
» Views: 858
The Limitation of Using O...
Forum: Obi Rope
Last Post: josemendez
01-09-2025, 10:30 PM
» Replies: 1
» Views: 594
Bug Where a Straight Segm...
Forum: Obi Rope
Last Post: josemendez
01-09-2025, 08:46 PM
» Replies: 1
» Views: 558
Having an issue with obi ...
Forum: Obi Rope
Last Post: Ben_bionic
29-08-2025, 04:23 PM
» Replies: 4
» Views: 1,061
Non-uniform particle dist...
Forum: Obi Rope
Last Post: chenji
29-08-2025, 09:05 AM
» Replies: 4
» Views: 904

 
  How to know when all the particles are sleeping so I can de-activate the ObiEmitter
Posted by: facaelectrica - 15-04-2020, 12:50 AM - Forum: Obi Fluid - Replies (5)

Hi,

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?

Print this item

  Moving Pin Constraints?
Posted by: EmmetOT - 14-04-2020, 05:53 PM - Forum: General - Replies (1)

I'm wondering is it possible to move pin constraints around on their attached collider's local space.

I have the following code (adapted from one of your samples),


Code:
ObiConstraints<ObiPinConstraintsBatch> pinConstraints = m_ropeBlueprint.GetConstraintsByType(Oni.ConstraintType.Pin) as ObiConstraints<ObiPinConstraintsBatch>;
ObiPinConstraintsBatch batch = pinConstraints.batches[0];
        
batch.AddConstraint(0, m_parentCollider, m_parentCollider.transform.InverseTransformPoint(SourcePosition), Quaternion.identity);
batch.AddConstraint(m_ropeBlueprint.activeParticleCount - 1, hitCollider.GetComponent<ObiColliderBase>(),
                                                    hitCollider.transform.InverseTransformPoint(hitPosition), Quaternion.identity);

batch.activeConstraintCount = 2;

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:


Code:
private void SetStartConstraint()
{
    ObiConstraints<ObiPinConstraintsBatch> pinConstraints = m_ropeBlueprint.GetConstraintsByType(Oni.ConstraintType.Pin) as ObiConstraints<ObiPinConstraintsBatch>;
    ObiPinConstraintsBatch batch = pinConstraints.batches[0];

    batch.offsets.SetVector3(0, m_parentCollider.transform.InverseTransformPoint(SourcePosition));

    //batch.AddConstraint(0, m_collider, m_parentCollider.transform.InverseTransformPoint(SourcePosition), Quaternion.identity);
}

Any ideas? Or maybe this is inadvisable?

Print this item

  Attaching a rigidbody to a hanging rope
Posted by: noman fareed - 14-04-2020, 03:30 PM - Forum: Obi Rope - Replies (1)

How can we attach a free rigidbody at one side of a hanging rope?

Print this item

  Question About Making Grappling Hook
Posted by: relevantname - 14-04-2020, 02:31 PM - Forum: Obi Rope - Replies (1)

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 tried it like this;

Code:
private IEnumerator Attach_Coroutine()
   {
       _rope.RemoveFromSolver(null);

       Quaternion lookRot =
           Quaternion.LookRotation(_rope.transform.position - GameManager.Instance.Ball.transform.position, -Vector3.forward);
       lookRot.x = 0.0f;
       lookRot.y = 0.0f;
       _rope.transform.rotation = lookRot;

       float distanceToBallFromHandle = Vector3.Distance(GameManager.Instance.Ball.transform.position, this.transform.position);
       float distanceToBallFromRopeEnd = distanceToBallFromHandle - _rope.CalculateLength();

       float attachSpeed = GameManager.Instance.handleAttachSpeed;

       _rope.AddToSolver(null);
       while (_rope.CalculateLength() <= distanceToBallFromHandle)
       {
           _ropeCursor.ChangeLength(_rope.RestLength + attachSpeed * Time.deltaTime);
           yield return null;
       }

       _ropePinConstraints.RemoveFromSolver(null);
       ObiPinConstraintBatch pinConstraintsBatch = _rope.PinConstraints.GetFirstBatch();
       pinConstraintsBatch.AddConstraint(_rope.UsedParticles-1, GameManager.Instance.Ball.GetComponent<ObiColliderBase>(), Vector3.zero,
           Quaternion.identity, 0);
       
       _ropePinConstraints.AddToSolver(null);
       
       _isAttached = true;
   }

But the attachment point is not the last particle of the rope.

I attached a photo that demonstrate what I want.

Thanks in advance.



Attached Files Thumbnail(s)
   
Print this item

  High variance in ObiFixedUpdate performance impact
Posted by: TheMunk - 14-04-2020, 01:27 PM - Forum: Obi Rope - Replies (14)

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:
[Image: 11ms.png]
Timestep 0.02 - 3.05ms:
[Image: 3ms.png]

Timestep 0.06 - 9.14ms:
[Image: 0-06-timestep.png]

Timestep 0.06 - 1.44ms:
[Image: 0-06-timestep-low.png]


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?

Print this item

  2D version of grappling hook demo
Posted by: EmmetOT - 13-04-2020, 04:44 PM - Forum: Obi Rope - Replies (1)

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":


Code:
private void Awake()
{
    m_rope = gameObject.AddComponent<ObiRope>();

    // 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;

    m_rope.GetComponent<MeshRenderer>().material = m_material;
    m_rope.maxBending = 0.02f;

    m_ropeBlueprint = ScriptableObject.CreateInstance<ObiRopeBlueprint>();
    m_ropeBlueprint.resolution = 0.5f;
       
    ...
}

private IEnumerator AttachHook(Vector3 worldSpacePoint, Collider2D hitCollider)
{
    yield return 0;
    Vector3 localHit = m_rope.transform.InverseTransformPoint(worldSpacePoint);
            
    // Procedurally generate the rope path (a simple straight line):
    m_ropeBlueprint.path.Clear();
    m_ropeBlueprint.path.AddControlPoint(Vector3.zero, -localHit.normalized, localHit.normalized, Vector3.up, 0.1f, 0.1f, 1, 1, Color.white, "Hook start");
    m_ropeBlueprint.path.AddControlPoint(localHit, -localHit.normalized, localHit.normalized, Vector3.up, 0.1f, 0.1f, 1, 1, Color.white, "Hook end");
    m_ropeBlueprint.path.FlushEvents();

    // 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.

[Image: 26omwRi.png]

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.

[Image: RIcjkje.png]

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!

Print this item

  Problem with cloth simulating just part of it.
Posted by: Binary - 13-04-2020, 03:50 PM - Forum: Obi Cloth - Replies (2)

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.

[Image: zfsgRHD.png]

Print this item

Exclamación Unity Cloud Build, XCode 11.3.1 Linker Issues
Posted by: dylanrw - 13-04-2020, 01:48 AM - Forum: Obi Rope - Replies (11)

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.

Print this item

  Drag a two sided attached rope
Posted by: noman fareed - 12-04-2020, 11:11 PM - Forum: Obi Rope - Replies (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.

Print this item

  Frequent stutters and slowdowns even with simple ropes
Posted by: SpiralCircus - 10-04-2020, 04:50 PM - Forum: Obi Rope - Replies (2)

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?

[Image: WvdPiZq.jpg]

Print this item