Search Forums

(Advanced Search)

Latest Threads
How To Increase Particle ...
Forum: Obi Cloth
Last Post: GrimCaplan
5 minutes ago
» Replies: 0
» Views: 1
Need help constraining th...
Forum: Obi Cloth
Last Post: invayne
1 hour ago
» Replies: 4
» Views: 36
Just Curious...
Forum: Obi Cloth
Last Post: GrimCaplan
8 hours ago
» Replies: 0
» Views: 5
Softbody Collision Issue
Forum: Obi Softbody
Last Post: StudioTatsu
9 hours ago
» Replies: 5
» Views: 79
Custom Rig and Skinning
Forum: Obi Softbody
Last Post: kleptine
Yesterday, 07:05 PM
» Replies: 0
» Views: 3
How to write Obi Shader f...
Forum: Obi Fluid
Last Post: NoDeadLine
Yesterday, 10:42 AM
» Replies: 0
» Views: 6
Creating Attachment Point...
Forum: Obi Rope
Last Post: zkkzkk32312
15-02-2020, 06:11 AM
» Replies: 2
» Views: 49
Small FPS on Android mobi...
Forum: Obi Fluid
Last Post: ktpttd
15-02-2020, 05:38 AM
» Replies: 9
» Views: 712
Water Balloon War
Forum: Obi Fluid
Last Post: Showva
14-02-2020, 06:17 PM
» Replies: 0
» Views: 20
Modifying Emitter
Forum: Obi Fluid
Last Post: ilterbilguven
14-02-2020, 03:56 PM
» Replies: 2
» Views: 19

 
  How To Increase Particle Elevation?
Posted by: GrimCaplan - 5 minutes ago - Forum: Obi Cloth - No Replies

I'm attempting to put together a simple script based off ObiParticlePicker that supports multiple touches. The multiple touches is working fine. The issue I'm having is that when I select a particle index, I do not seem to understand how to modify the particle's position.

I'm attempting to add a value to the y-level of a renderable position in order to increase its height. I know the axis in which I need to affect depends on the rotation and position of the cloth.

I have also done some debugging and confirmed that an index is in-fact being selected.

   

Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Obi;

public class SlimeSolverManager : MonoBehaviour
{
   [SerializeField]
   ObiSolver m_Solver;

   [SerializeField]
   float m_TouchRadius;
   [SerializeField]
   float m_TouchDistortionLevel = 1;

   private int[] m_PickedParticleIndices;
   private float pickedParticleDepth = 0;

   private void OnEnable()
   {
       Debug.Assert(m_Solver != null, "Slime Solver Manager Missing Obi Solver Component Reference!");
   }

   // Update is called once per frame
   void LateUpdate()
   {
       if (m_Solver)
       {
           if (Input.touchCount > 0)
               m_PickedParticleIndices = new int[Input.touchCount];

           foreach (Touch touch in Input.touches)
           {
               m_PickedParticleIndices[touch.fingerId] = -1;

               Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

               float closestMu = float.MaxValue;
               float closestDistance = float.MaxValue;

               // Find the closest particle hit by the ray:
               for (int i = 0; i < m_Solver.renderablePositions.count; ++i)
               {
                   float mu;
                   Vector3 projected = ObiUtils.ProjectPointLine
                       (m_Solver.renderablePositions[i], ray.origin, ray.origin + ray.direction, out mu, false);

                   float distanceToRay = Vector3.SqrMagnitude
                       ((Vector3)m_Solver.renderablePositions[i] - projected);

                   mu = Mathf.Max(0, mu);

                   float radius = m_Solver.principalRadii[i][0] * m_TouchRadius;

                   if (distanceToRay <= radius * radius && distanceToRay < closestDistance && mu < closestMu)
                   {
                       closestMu = mu;
                       closestDistance = distanceToRay;
                       m_PickedParticleIndices[touch.fingerId] = i;
                   }
               }

               if (m_PickedParticleIndices[touch.fingerId] >= 0)
               {
                   pickedParticleDepth = Camera.main.transform.InverseTransformVector((Vector3)m_Solver.renderablePositions
                       [m_PickedParticleIndices[touch.fingerId]] - Camera.main.transform.position).z;

                   Vector3 worldPosition = Camera.main.ScreenToWorldPoint
                           (new Vector3(Input.mousePosition.x, Input.mousePosition.y, pickedParticleDepth));

                   float x = m_Solver.renderablePositions[m_PickedParticleIndices[touch.fingerId]].x;
                   float y = m_Solver.renderablePositions[m_PickedParticleIndices[touch.fingerId]].y;
                   float z = m_Solver.renderablePositions[m_PickedParticleIndices[touch.fingerId]].z;
                   float w = m_Solver.renderablePositions[m_PickedParticleIndices[touch.fingerId]].w;

                   m_Solver.renderablePositions
                       [m_PickedParticleIndices[touch.fingerId]] =
                           new Vector4(x, y + m_TouchDistortionLevel, z, w);
               }

           }

       }
   }
}

I know the declaration of four floats is a little lazy but at this point I'm simply trying to get results. I'll opt later.

Print this item

  Just Curious...
Posted by: GrimCaplan - 8 hours ago - Forum: Obi Cloth - No Replies

I was wondering what 'Mu' means in the ObiParticlePicker?

Like not just its function, but what the 'm' and the 'u' actually stand for? Is it like measured unit or..?

Print this item

  Custom Rig and Skinning
Posted by: kleptine - Yesterday, 07:05 PM - Forum: Obi Softbody - No Replies

I have a variety of very spindly objects (plants mostly), with premade skeletons and skinning weights. Is there any way to specify Obi Softbody to use a custom set of points/physical properties/shape-matching groups for an object? The built-in generator is fine for simple objects, but it really doesn't work well for thin stuff (because the shape matching binds shapes across nearby leaves).

Print this item

  How to write Obi Shader for LWRP?
Posted by: NoDeadLine - Yesterday, 10:42 AM - Forum: Obi Fluid - No Replies

it works perfect on mobiles, but i want to add 2d lights (LWRP) for my environment, when i change pipeline to LWRP - obi fluid renderer just empty(only Foam generater works, it's 2d particles). Any suggestions please?

Print this item

  Need help constraining the cape to a location
Posted by: invayne - 15-02-2020, 07:48 PM - Forum: Obi Cloth - Replies (4)

So I am trying to set constraints to my cape so that only a part of it simulates cloth is there a way to do this? below is a before and after.
I only want the bottom half of my cape to simulate cloth.

[Image: Untitled.png]

[Image: Untitled1.png]

Print this item

  Water Balloon War
Posted by: Showva - 14-02-2020, 06:17 PM - Forum: Obi Fluid - No Replies

First I'm sorry for my English. The google translator who translated this text for me.

Contextualizing: I am creating a game to learn to develop. and my project is a "water balloon war" game, where each player will have a number of water balloons and the goal is to see who "wets" the opponent the most.
Doubts:
1 - How do I leave the fluid with infinite life? Just leaving the lifespan with an absurd number?
2 - It is difficult to explain this doubt and perhaps it is something obvious to you, but for me it is a little confused. What is the best method of creating a prefab using water balloon containing OBI fluid?

Print this item

  Modifying Emitter
Posted by: ilterbilguven - 14-02-2020, 01:59 PM - Forum: Obi Fluid - Replies (2)

Hi,

Current emitter kills particles by lifespan. I want emitter to kill by position (For example, if a particle's Y position is below -5).

I managed to kill by that, but now emitter isn't working properly after when a particle is killed. How can I fix this?

Here's my CustomEmitter:

Code:
namespace Obi
{
  [AddComponentMenu("Physics/Obi/Obi Emitter", 850)]
  [ExecuteInEditMode]
  public class CustomObiEmitter : ObiActor
  {
     .
      .
      .

     [SerializeField] private float[] _posYs;
     
     public override void LoadBlueprint(ObiSolver solver)
     {
        .

        _posYs = new float[particleCount];
        for (var i = 0; i < _posYs.Length; ++i)
           _posYs[i] = 1;
       
        .
     }

      .
      .
      .

     protected override void SwapWithFirstInactiveParticle(int index)
     {
        .
        _posYs.Swap(index, activeParticleCount);
     }


     public bool EmitParticle(float offset, float deltaTime)
     {
        .
       
        _posYs[activeParticleCount] = 1;
       
        .
         .
         .
     }


     public override void BeginStep(float stepTime)
     {
         .
         .
         .
       
        for (int i = activeParticleCount - 1; i >= 0; --i)
        {
           _posYs[i] = m_Solver.positions[i].y;

           if (_posYs[i] <= -5)
           {
              KillParticle(i);
           }
        }

        .
         .
         .
       
       
     }
  }
}

Print this item

  Pulling on a slack rope laying on the ground
Posted by: basilisk - 13-02-2020, 09:58 PM - Forum: Obi Rope - Replies (2)

So I've made a a small S-shaped slack of rope and it's laying on the ground (terrain).

When I pull one side of it, the whole rope (including the bendy slack) moves with the pulled end.

The rope should pull straight and give up that S-shape, but mine doesn't. If I pull it straight up into the air, then it does! Gravity pulls the rope straight and it looks really loose and proper. But dragging it across the ground does not.

I'm sure I have some settings incorrect, but I cannot figure it out!

Print this item

  OpaqueFluidShader w/ 2019.3 & URP
Posted by: ilterbilguven - 13-02-2020, 04:21 PM - Forum: Obi Fluid - No Replies

Hi,

I'm using this asset with Unity 2019.3(.1f1 / .0f6) with URP. While using OpaqueFluidShader, I encountered a bug: In built project, fluid is darker than than I saw in editor. To reproduce the issue in the editor; close scene tab, and restart Unity. Then, in play mode (while scene tab is not opened in anywhere), you can see the fluid is darker. But, when you open the scene tab, fluid get brighter. I have no issue with dielectricfluid & fluidcolorblend.


Is there anything to fix this?

Print this item

  Reset rope starting shape?
Posted by: basilisk - 13-02-2020, 12:18 PM - Forum: Obi Rope - Replies (4)

I have a coiled rope that unwinds nicely when the rope is enabled. I want to have the rope reset to it's starting coiled shape every time I activate it. How to I reset the rope to it's original shape?

Print this item