Search Forums

(Advanced Search)

Latest Threads
How to dynamically change...
Forum: Obi Rope
Last Post: quent_1982
04-07-2025, 11:29 AM
» Replies: 2
» Views: 88
Pipeline that bends
Forum: Obi Softbody
Last Post: josemendez
04-07-2025, 09:52 AM
» Replies: 13
» Views: 781
How to implement/sync Obi...
Forum: Obi Rope
Last Post: quent_1982
01-07-2025, 01:48 PM
» Replies: 2
» Views: 179
Collisions don't work con...
Forum: Obi Rope
Last Post: chenji
27-06-2025, 03:05 AM
» Replies: 3
» Views: 251
Force Zone apply differen...
Forum: Obi Rope
Last Post: chenji
26-06-2025, 11:41 AM
» Replies: 11
» Views: 728
Can I blend in and out of...
Forum: Obi Cloth
Last Post: josemendez
24-06-2025, 04:42 PM
» Replies: 3
» Views: 239
Using a rigidbody/collide...
Forum: Obi Cloth
Last Post: josemendez
24-06-2025, 09:29 AM
» Replies: 1
» Views: 142
Solver is too performance...
Forum: Obi Rope
Last Post: quent_1982
20-06-2025, 08:09 AM
» Replies: 40
» Views: 4,207
Obi 7 Model Scaling
Forum: Obi Cloth
Last Post: alkis
19-06-2025, 02:37 PM
» Replies: 2
» Views: 254
Obi Softbody instability?
Forum: Obi Softbody
Last Post: Aroosh
18-06-2025, 06:35 PM
» Replies: 0
» Views: 133

 
  Destroying objects improperly?
Posted by: Lluluien - 07-08-2018, 08:31 PM - Forum: Obi Cloth - Replies (1)

Edit: I consistently crash now even before I destroy any of the objects I describe below, so there must be something else (or additional) going on. See next post as well.
----------------------

I'm trying to use the Obi Cloth asset for simulations on two different objects in my game.

One of them is statically created in the editor and built directly into the scene.  I'm really happy with how these look so far, and I had no problem at that point.

However, one of them is dynamically created, and when I started trying to run my game after I got it set up to use Obi Cloth for this object, it started crashing my game, seemingly at random.

I've been chasing this down for about 3 days: I've updated Unity, updated Visual Studio, rebooted several times, read through your forums, looked at log files from Unity and the crashes, and so on.  I've come to believe the problem has to do with destroying one of these dynamically instantiated prefabs.

I've got this prefab set up with everything my static objects have except for the Obi Solver, which I assign when the object is created.  The solver in the gameMaster singleton is the same one I am using for the static objects:

Code:
protected void Start()
{
   obiCloth = GetComponentInChildren<ObiCloth>();
   obiCloth.Solver = gameMaster.obiSolver;
}



Several of the Unity logs right before the crash have references to the \Obi\Scripts\Actors\ObiActor.cs script at line 474:
Code:
// check if any of the involved transforms has changed since last time:
if (!transform.hasChanged && !Solver.transform.hasChanged)
   return;


When I found this, I thought, okay, maybe this is as simple as just some kind of object destruction race condition and I can fix it with a couple easy changes.  I turned the previous code into this: 

Code:
if (null == Solver || null == transform || null == Solver.transform) {
   return;
}

// check if any of the involved transforms has changed since last time:
if (!transform.hasChanged && !Solver.transform.hasChanged)
   return;

and then added this to top of the OnDestroy() call on the object being destroyed:
Code:
obiCloth.RemoveFromSolver(null);
obiCloth.Solver = null;



However, I'm still getting crashes, so I wonder if there is something I am missing about the proper methodology for destroying an actively simulated ObiActor.  I've looked around on the tutorials page and don't see anything about destroying objects, even though there is information about spawning them.  I looked around in the API docs, but they're not very helpful - for instance, what are the (object item) parameters I see in there?  I had to google "obi removefromsolver" to find out I could just pass null to the ObiActor.RemoveFromSolver() function by looking at some other piece of sample code you have on the site.

Here is the error that I'm sure is precipitating the latest crash I had that is still referencing the null checks I added in the code block above.  See the 5th line, the first call to Obi.ObiActor.OnSolverStepBegin() line 473:
Code:
NullReferenceException: Object reference not set to an instance of an object
 at UnityEngine.Object.IsNativeObjectAlive (UnityEngine.Object o) [0x0001d] in C:\buildslave\unity\build\Runtime\Export\UnityEngineObject.bindings.cs:179
 at UnityEngine.Object.CompareBaseObjects (UnityEngine.Object lhs, UnityEngine.Object rhs) [0x0003a] in C:\buildslave\unity\build\Runtime\Export\UnityEngineObject.bindings.cs:141
 at UnityEngine.Object.op_Equality (UnityEngine.Object x, UnityEngine.Object y) [0x00003] in C:\buildslave\unity\build\Runtime\Export\UnityEngineObject.bindings.cs:401
 at Obi.ObiActor.OnSolverStepBegin () [0x00019] in D:\unity\projects\Tapestry\Tapestry\Assets\Obi\Scripts\Actors\ObiActor.cs:473
 at Obi.ObiCloth.OnSolverStepBegin () [0x00014] in D:\unity\projects\Tapestry\Tapestry\Assets\Obi\Scripts\Actors\ObiCloth.cs:564
 at Obi.ObiSolver.SimulateStep (System.Single stepTime) [0x00052] in D:\unity\projects\Tapestry\Tapestry\Assets\Obi\Scripts\Solver\ObiSolver.cs:545
 at Obi.ObiSolver.LateUpdate () [0x00056] in D:\unity\projects\Tapestry\Tapestry\Assets\Obi\Scripts\Solver\ObiSolver.cs:775

I'm not sure what sorcery goes on in the manipulation of your backend C++ objects in the Unity C# code, but that "IsNativeObjectAlive" call sure looks like there's something going wrong in the destruction of this object that isn't letting the ObiSolver know that it can forgo simulating the object in this frame when it's about to die.  The crash always immediately follows this NullReferenceException error in OnSolverStepBegin().

The question is: Am I doing something wrong in how I'm either allocating or destroying the gameobject which is causing this, or is it a bug in the ObiCloth/ObiActor/ObiSolver code somewhere?

While we're on the topic, I have a question about when I'm instantiating the object and getting it to run.  In the same ObiActor code, it looks like the object gets added to the Obi Solver here:
Code:
public virtual void Start(){
   if (Application.isPlaying)
       AddToSolver(null);
}

I don't see anywhere else when the solver gets assigned that this would happen:
Code:
public ObiSolver Solver{
   get{return solver;}
   set{
       if (solver != value){
           RemoveFromSolver(null);
           solver = value;
       }
   }
}

So I'm probably just getting lucky that this race condition between my object's Start() and the ObiCloth() start hasn't bitten me.  It looks like my code should actually be:

Code:
protected void Start()
{
   obiCloth = GetComponentInChildren<ObiCloth>();
   obiCloth.Solver = gameMaster.obiSolver;            
   obiCloth.AddToSolver(null);
}

Correct?


Thanks ahead of time for your help!

Quick edit: Everything works fine until the game crashes - the dynamically instantiated object is simulated the way I expect it to be, the static ones are still working, etc. The game sometimes crashes in 15 seconds, sometimes in 10 minutes, and everywhere in between. This is why I suspect a race condition.

Print this item

Triste Obi Cloth Tears By Itself
Posted by: jb88886 - 06-08-2018, 12:04 AM - Forum: Obi Cloth - Replies (1)

I copied the cloth gameobject from the TearableCloth same scene to mess around with it a little bit. I'm not sure what exactly I did, but now the cloth will tear by itself at the start of run time and I'm not sure how to fix it.

Print this item

  Obi Rope and VR
Posted by: Peny22 - 05-08-2018, 04:48 PM - Forum: Obi Rope - Replies (6)

Hello, I am developing a VR application in which its user will connect different kinds of cables to appropriate devices. I wonder whether to buy your ObiRope asset. I have a couple of questions.
1. How will a created rope/wire behave during a teleportation if an application user holds it in his hands when: a) one end of it is connected to an unmovable object while the other one is movable b) both ends are movable? The user will only be able to grip a connector - e.g.  a HDMI connector instead of a jacket of the wire. 
2. How much does the asset affect efficiency? Are 30 wires able to make a significant difference to efficiency? How much is a cpu used by the asset?
3. Will it be possible to get a refund if the asset doesn't work well with my application?
4. Is it hard to use Obi Rope for a beginner in Unity?

Print this item

  Cloth is very stretchy and elastic
Posted by: adami - 05-08-2018, 01:17 PM - Forum: Obi Cloth - Replies (2)

Hi, 

I've been reading the forum, documentation and watched the youtube videos but despite generating my tether constraints, increasing my obi solver > constraints > iterations to 50 my cloth really appears very very elastic and stretchy. What are the settings that I need to change to reduce this?

Any advice on this would be greatly appreciated. 

thanks.

Print this item

Triste How to make curve in Obi Rope?
Posted by: Prateek - 03-08-2018, 10:46 AM - Forum: Obi Rope - Replies (4)

Hello,

I purchased obi latest version for rope. I am trying to make the curve shape using rope sdk. Is anyone know how to make the curve shape in Obi Rope?

Print this item

  ECS / Jobs / using the Burst Compiler planned ?
Posted by: ibbybn - 02-08-2018, 10:28 PM - Forum: General - Replies (16)

Hey Obi Team,
wondering if these Unity 2018 features are planned to be used? I guess it would mean porting more from c++ to c#?
Would be interesting to see the performance gains. It seems fitted perfectly for particle systems running on CPU.
I ported a simple boid system ( fish swarm ) to jobs/ecs hybrid and got 20x performance gain so far.

Print this item

  Cloth does not follow animation
Posted by: adev eloper - 01-08-2018, 04:29 PM - Forum: Obi Cloth - Replies (9)

I am testing various setups for clothing simulation and using skin weighs does not seem appropriate for realistic results.
I am now experimenting with mesh collider but the cloth does not follow the animation. It works fine if the mesh is static. Can you please help?

Print this item

  Obi Mesh Topology Generation Issue
Posted by: Saismirk - 31-07-2018, 12:04 AM - Forum: Obi Cloth - Replies (3)

After countless times trying to generate a mesh topology, no matter the mesh in question, this error always appears:

ArgumentOutOfRangeException: Argument is out of range.
System.Array.Resize[Vertex] (.Vertex[]& array, Int32 length, Int32 newSize) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Array.cs:1919)
System.Array.Resize[Vertex] (.Vertex[]& array, Int32 newSize) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Array.cs:1913)
Obi.ObiMeshTopology.Generate () (at Assets/Obi/Scripts/DataStructures/ObiMeshTopology.cs:272)
Obi.ObiMeshTopologyEditor.OnInspectorGUI () (at Assets/Obi/Editor/ObiMeshTopologyEditor.cs:70)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1374)
UnityEngine.GUIUtilityLenguarocessEvent(Int32, IntPtr)


I have made sure the models are 2-manifolds but at this point I don't know what to do. I'm working with 3DSMax for my models. FBX format, skinned and non-skinned.

Print this item

Pregunta OBI Rope knot issue
Posted by: Prateek - 30-07-2018, 06:16 AM - Forum: Obi Rope - No Replies

Hello,
 
I have downloaded and using your obi sdk named Obi Rope in which I want to make a knot using "Obi Rope" but when I try to make a knot by using string, strings gets penetrate from each other and I am unable to make required functionality done. Kindly Help me to make it possible.

Print this item

  Change aero constraint properties with script
Posted by: domkonecny - 19-07-2018, 03:54 PM - Forum: Obi Cloth - Replies (2)

Hello
I want to change air density on my cloths on runtime. It works perfectly well if i change it manually in editor. I am probably just missing some call, and I cant find it in the docs. 
Now it looks like this.

Code:
ObiAerodynamicConstraints aero;
aero = this.GetComponent<ObiAerodynamicConstraints>();
aero.airDensity = 0.04f;

The value changes on the component in editor, but has no effect.

Print this item