Latest Threads |
Stretching verts uniforml...
Forum: Obi Softbody
Last Post: josemendez
15-09-2025, 04:32 PM
» Replies: 1
» Views: 230
|
Scripting rod forces
Forum: Obi Rope
Last Post: chenji
11-09-2025, 01:15 PM
» Replies: 25
» Views: 3,170
|
Burst error causing crash...
Forum: Obi Rope
Last Post: josemendez
10-09-2025, 07:03 AM
» Replies: 1
» Views: 305
|
Controlling speed of emit...
Forum: Obi Fluid
Last Post: josemendez
06-09-2025, 06:29 AM
» Replies: 1
» Views: 587
|
Looks nice on editor but ...
Forum: Obi Fluid
Last Post: josemendez
04-09-2025, 07:20 AM
» Replies: 3
» Views: 827
|
How to Shorten or Scale t...
Forum: Obi Rope
Last Post: josemendez
02-09-2025, 09:53 AM
» Replies: 5
» Views: 887
|
The Limitation of Using O...
Forum: Obi Rope
Last Post: josemendez
01-09-2025, 10:30 PM
» Replies: 1
» Views: 615
|
Bug Where a Straight Segm...
Forum: Obi Rope
Last Post: josemendez
01-09-2025, 08:46 PM
» Replies: 1
» Views: 579
|
Having an issue with obi ...
Forum: Obi Rope
Last Post: Ben_bionic
29-08-2025, 04:23 PM
» Replies: 4
» Views: 1,082
|
Non-uniform particle dist...
Forum: Obi Rope
Last Post: chenji
29-08-2025, 09:05 AM
» Replies: 4
» Views: 927
|
|
|
Fixed timestep issue |
Posted by: Elastic Sea - 18-02-2020, 08:50 PM - Forum: Obi Rope
- Replies (2)
|
 |
When I make the fixed timestamp shorter the rope starts behaving erratically and moves faster and faster. Do I have to keep the timestamp on 0.02?
Opening the sample scene with the crane can cause this, please take a look at this video
https://imgur.com/a/cGSBigv
Unity 2019.3.1f1
Obi Rope 5.1
|
|
|
How To Increase Particle Elevation? |
Posted by: GrimCaplan - 17-02-2020, 07:36 AM - Forum: Obi Cloth
- Replies (4)
|
 |
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.
The reason for this is because I don't really want the effect that the particle dragger produces. When moving the finger around the screen it attempts to hold on to that particle even if I swipe to the other side of the screen whereas my desired functionality is the elevation and/or depression of particles under the finger. I know I could simply adapt the OnParticleDragged and treat all movement as a sequence of OnParticlePicked and then OnParticleReleased, but my goal is not just functioning but actually increasing my understanding of the system. I'll probably be using it a lot in the future. Directly effecting the elevation also seems less 'hackish' than hooking the two events in series.
Also if it would be helpful you can use the multi-touch for the "courtesy" code because that does actually work. I promise I'm not a terrible developer, Obi has just been hard for me to absorb.
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.
|
|
|
Just Curious... |
Posted by: GrimCaplan - 16-02-2020, 10:57 PM - Forum: Obi Cloth
- Replies (2)
|
 |
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..?
|
|
|
Custom Rig and Skinning |
Posted by: kleptine - 16-02-2020, 07:05 PM - Forum: Obi Softbody
- Replies (1)
|
 |
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).
|
|
|
How to write Obi Shader for LWRP? |
Posted by: NoDeadLine - 16-02-2020, 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?
|
|
|
Water Balloon War |
Posted by: Showva - 14-02-2020, 06:17 PM - Forum: Obi Fluid
- Replies (1)
|
 |
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?
|
|
|
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);
}
}
.
.
.
}
}
}
|
|
|
|