Search Forums

(Advanced Search)

Latest Threads
Force Zone apply differen...
Forum: Obi Rope
Last Post: chenji
37 minutes ago
» Replies: 11
» Views: 342
Can I blend in and out of...
Forum: Obi Cloth
Last Post: josemendez
24-06-2025, 04:42 PM
» Replies: 3
» Views: 138
Using a rigidbody/collide...
Forum: Obi Cloth
Last Post: josemendez
24-06-2025, 09:29 AM
» Replies: 1
» Views: 60
Solver is too performance...
Forum: Obi Rope
Last Post: quent_1982
20-06-2025, 08:09 AM
» Replies: 40
» Views: 3,256
Obi 7 Model Scaling
Forum: Obi Cloth
Last Post: alkis
19-06-2025, 02:37 PM
» Replies: 2
» Views: 206
Obi Softbody instability?
Forum: Obi Softbody
Last Post: Aroosh
18-06-2025, 06:35 PM
» Replies: 0
» Views: 102
Tear Rod
Forum: Obi Rope
Last Post: chenji
18-06-2025, 08:34 AM
» Replies: 2
» Views: 168
Pipeline that bends
Forum: Obi Softbody
Last Post: josemendez
17-06-2025, 02:07 PM
» Replies: 11
» Views: 495
Memory Leaks?
Forum: General
Last Post: josemendez
16-06-2025, 08:45 PM
» Replies: 3
» Views: 284
Obi 7.0 ParticleAPI
Forum: Obi Rope
Last Post: alicecatalano
12-06-2025, 09:19 AM
» Replies: 12
» Views: 2,068

 
  Generating and using distance field at runtime
Posted by: fortinmike - 16-11-2019, 03:57 PM - Forum: Obi Fluid - No Replies

Hi there,

I'm using Obi Fluid in my game and so far it works very well! However, there is something very specific to my use case that I'm trying to accomplish without success so far.

I'm generating a mesh at runtime through a script. I've been able to make fluid collisions work with it by adding the ObiCollider to my mesh-containing GameObject at runtime, after the mesh is updated, like so:

Code:
void RecreateObiCollider()
   {
       Destroy(_plane.GetComponent<ObiCollider>());

       _plane.AddComponent<ObiCollider>();
       var collider = _plane.GetComponent<ObiCollider>();
       collider.CollisionMaterial = _collisionMaterial;
   }

However as my plane has many vertices, you can guess that performance is far from excellent with lots of particles.

I've investigated using a distance field to gain performance and I was able to make collisions work with a static mesh of the same plane and performance did increase substantially.

The issue I have is that I need to use a runtime generated mesh for collision detection; there is no way for me to know what the mesh will look like in advance to generate a distance field for it in the editor. Thus, I'm trying to generate and assign the distance field at runtime after generating my mesh. I haven't been able to get this working.

Here is the code I have so far. When that code runs, collisions work just fine until the distanceField.Generate() coroutine ends, after which the distance field is assigned. Then, collisions stop working completely and particles go right through my mesh. As far as the setup is concerned, it looks fine in the editor in play mode; the distance field is assigned and enabled, etc.

Code:
IEnumerator RecreateObiCollider()
   {
       Destroy(_plane.GetComponent<ObiCollider>());

       var distanceField = (ObiDistanceField)ScriptableObject.CreateInstance("ObiDistanceField");
       distanceField.InputMesh = _mesh;
       yield return StartCoroutine(distanceField.Generate());

       var collider = _plane.AddComponent<ObiCollider>();
       collider.CollisionMaterial = _collisionMaterial;
       collider.distanceField = distanceField;
       collider.UseDistanceFields = true;
   }

Any help would be appreciated!

Print this item

  Particles and fluid not rendering in running game
Posted by: Protemus - 16-11-2019, 05:05 AM - Forum: Obi Fluid - Replies (5)

I can't seem to figure out how to get the fluid displaying in the game when I run it.  If  run the game, I can switch to the "Scene" tab and if I turn on "Edit Particles" in the emitter I can see that my particles are indeed there and running, they just aren't getting rendered.

I have added an Obi Emitter, an Obi Emitter Shape Disk and an Obi Particle Renderer all to an empty game object. (I attached the settings screenshot here), but it just doesn't seem to render in my game when it is running.  And idea what I could be doing wrong here?

Thanks,
Sean

Print this item

  Avoid softbody getting stuck in the wall
Posted by: manurocker95 - 14-11-2019, 10:18 AM - Forum: Obi Softbody - Replies (2)

When dragging with the particle dragger, the objects get stuck in the wall. I increased the solver collision evaluations to 10 but it still happens. Any clue?

Print this item

  Scripting Particles not working and cube passing through
Posted by: manurocker95 - 14-11-2019, 10:15 AM - Forum: Obi Softbody - No Replies

Hi! Just made the scripts from http://obi.virtualmethodstudio.com/tutor...icles.html with the exact same code (adding the solver variable) to a simple scene and it just do nothing. But nothing at all. In addition, I made a simple cube, added the softbody component and it passes through the floor. Can someone try to help me? 

Video of what happens: https://gofile.io/?c=EgFZja



Btw, a discord for support instead of this forum, would be nice.

Print this item

  Obi + Havok
Posted by: Barliesque - 13-11-2019, 07:44 PM - Forum: General - Replies (5)

Will the Obi physics engine eventually be able to interact with Unity's support for Havok?  The reliability and performance of Havok over Unity's built-in physics is *very* compelling.

Print this item

  Handle creation under the same parent object?
Posted by: Bill Sansky - 13-11-2019, 03:10 PM - Forum: General - Replies (1)

Hi!

I have a small suggestion for the handle creation (but I guess this may be irrelevant due to Obi 1.5 coming):
Could we have the handles be created under the same parent object as the parent of the obi actor in Unity's Hierarchy?
The reason I am asking is that when you are in prefab edition mode, currently you cannot create handles as they are added to the scene of the prefab so they won't be saved in the prefab.

If the handle would be added under the same parent, it would directly be in the prefab.

Thanks!

Edit: I fixed it on my side by adding " c.transform.SetParent(actor.transform.parent);" in the ObiParticleActorEditor class after line 1130, but I suppose this fix could be interesting for users in general since the nested prefabs are starting to be more in use.

Print this item

  How to use one softbody with separated skinned meshes
Posted by: manurocker95 - 13-11-2019, 01:48 PM - Forum: Obi Softbody - Replies (6)

Hi! My objects have separated skinned meshes instead of just one. How do I use one softbody for all the softbody skinners? Do I have to bake the mesh before using it?

Print this item

  Obi does not handle the new Scene loading in 2019.3
Posted by: Bill Sansky - 12-11-2019, 11:09 PM - Forum: General - Replies (2)

Hi,

In case you guys are not aware of this, Obi does not handle well the new "Enter Play Mode without domain / scene reload" thing from Unity 2019.3 beta
Some obi colliders are skipped and sometimes the pins behave in an unstable way.

It seems to be caused by some static variables not being properly re-initialized

I tried to fix it by clearing the collider dictionary with a static method with the [RuntimeInitializeOnLoadMethod] attribute, but it's not working perfectly even with that.

Is there any other static referencing involved?

Thanks!

Print this item

  Dragging?? Create pin contraints / handles in runtime?
Posted by: manurocker95 - 12-11-2019, 04:36 PM - Forum: Obi Softbody - Replies (2)

Hi! I would like to drag an object with a grasper. The thing is that obi particle dragger works as a spring and i need to follow the grasper transform without that bouncing effect, so what's the correct way to do it? Can I create constraints in real time so I can attach the grasper surface to the particles that are being touched?

Print this item

  Error and Set position by transform
Posted by: manurocker95 - 12-11-2019, 04:19 PM - Forum: Obi Softbody - No Replies

Hi! I have an object which i need to drag from the point I touch. Now I'm moving it by transform, but I can't do that as the object doesn't move. When using handles, i'm getting this error:

transform.position assign attempt for 'Ball' is not valid. Input position is { NaN, NaN, NaN }.
0x00007FF75F5F422C (Unity) StackWalker::GetCurrentCallstack
0x00007FF75F5F7701 (Unity) StackWalker::ShowCallstack
0x00007FF75DE8FCA5 (Unity) GetStacktrace
0x00007FF7601AB68D (Unity) DebugStringToFile
0x00007FF7601EEAAE (Unity) Transform::SetPosition
0x00007FF75F700D34 (Unity) Transform_CUSTOM_set_position_Injected
0x000002879ED92CC9 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.TransformConfundidoet_position_Injected (UnityEngine.Transform,UnityEngine.Vector3&)
0x000002879ED92B3B (Mono JIT Code) UnityEngine.TransformConfundidoet_position (UnityEngine.Vector3)
0x000002879EE0C163 (Mono JIT Code) [ObiSoftbody.cs:65] Obi.ObiSoftbody:OnSolverStepEnd (single) 
0x000002879EE0B3D0 (Mono JIT Code) [ObiSolver.cs:877] Obi.ObiSolver:AllSolversStepEnd () 
0x000002879EE0AE3B (Mono JIT Code) [ObiArbiter.cs:45] Obi.ObiArbiter:WaitForAllSolvers () 
0x000002879EE0A933 (Mono JIT Code) [ObiSolver.cs:784] Obi.ObiSolver:WaitForAllSolvers () 
0x000002879EE06C73 (Mono JIT Code) [ObiSolver.cs:672] Obi.ObiSolver:SimulateStep (single) 
0x000002879EE03B43 (Mono JIT Code) [ObiSolver.cs:866] Obi.ObiSolver:FixedUpdate () 
0x00000287B79C6108 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007FFDBD02C090 (mono-2.0-bdwgc) [mini-runtime.c:2809] mono_jit_runtime_invoke 
0x00007FFDBCFB2142 (mono-2.0-bdwgc) [object.c:2921] do_runtime_invoke 
0x00007FFDBCFBB13F (mono-2.0-bdwgc) [object.c:2968] mono_runtime_invoke 
0x00007FF75F57E462 (Unity) scripting_method_invoke
0x00007FF75F578111 (Unity) ScriptingInvocation::Invoke
0x00007FF75F5311FB (Unity) MonoBehaviour::CallMethodIfAvailable
0x00007FF75F5315E6 (Unity) MonoBehaviour::CallUpdateMethod
0x00007FF75EC35238 (Unity) BaseBehaviourManager::CommonUpdate<FixedBehaviourManager>
0x00007FF75EC3DAA4 (Unity) FixedBehaviourManager::Update
0x00007FF75F0545AC (Unity) `InitPlayerLoopCallbacks'::`2'::FixedUpdateScriptRunBehaviourFixedUpdateRegistrator::Forward
0x00007FF75F03E588 (Unity) ExecutePlayerLoop
0x00007FF75F03E669 (Unity) ExecutePlayerLoop
0x00007FF75F0434DB (Unity) PlayerLoop
0x00007FF75D602A7B (Unity) PlayerLoopController::UpdateScene
0x00007FF75D60052C (Unity) Application::TickTimer
0x00007FF75DE971C0 (Unity) MainMessageLoop
0x00007FF75DE99BDF (Unity) WinMain
0x00007FF760B46952 (Unity) __scrt_common_main_seh
0x00007FFE2DD77BD4 (KERNEL32) BaseThreadInitThunk
0x00007FFE2F08CED1 (ntdll) RtlUserThreadStart

and the mesh disappears. reinitializing and binding again doesn't work. Any clue?

Print this item