Latest Threads |
Stretching verts uniforml...
Forum: Obi Softbody
Last Post: Aroosh
Yesterday, 05:32 AM
» Replies: 0
» Views: 71
|
Scripting rod forces
Forum: Obi Rope
Last Post: chenji
11-09-2025, 01:15 PM
» Replies: 25
» Views: 2,777
|
Burst error causing crash...
Forum: Obi Rope
Last Post: josemendez
10-09-2025, 07:03 AM
» Replies: 1
» Views: 190
|
Controlling speed of emit...
Forum: Obi Fluid
Last Post: josemendez
06-09-2025, 06:29 AM
» Replies: 1
» Views: 440
|
Looks nice on editor but ...
Forum: Obi Fluid
Last Post: josemendez
04-09-2025, 07:20 AM
» Replies: 3
» Views: 693
|
How to Shorten or Scale t...
Forum: Obi Rope
Last Post: josemendez
02-09-2025, 09:53 AM
» Replies: 5
» Views: 781
|
The Limitation of Using O...
Forum: Obi Rope
Last Post: josemendez
01-09-2025, 10:30 PM
» Replies: 1
» Views: 519
|
Bug Where a Straight Segm...
Forum: Obi Rope
Last Post: josemendez
01-09-2025, 08:46 PM
» Replies: 1
» Views: 492
|
Having an issue with obi ...
Forum: Obi Rope
Last Post: Ben_bionic
29-08-2025, 04:23 PM
» Replies: 4
» Views: 990
|
Non-uniform particle dist...
Forum: Obi Rope
Last Post: chenji
29-08-2025, 09:05 AM
» Replies: 4
» Views: 836
|
|
|
WebGL support with new backend ? |
Posted by: mmortall - 27-05-2021, 06:34 PM - Forum: General
- Replies (2)
|
 |
Since we have a new Jobs-based Obi backend is there a chance to get webgl support someday? I tried the latest Obi CLoth version with webgl but I have some errors when I am adding cloth to simulation. At least it compiles now.
|
|
|
How to change the rest length of an existing rope at runtime? |
Posted by: Hatchling - 26-05-2021, 09:27 PM - Forum: Obi Rope
- Replies (4)
|
 |
I've encountered a situation where I need to change the rest length of a rope that is already present in the scene.
I think I've figured out the solution, and the code seems to work, but I wanted to have you look over it to make sure I'm doing everything correctly (or if there's a better way).
I've added the following method inside ObiRopeBlueprintBase:
Code: public void SetRestLength(float newLength)
{
if(path == null)
{
Debug.LogError("Cannot set length because the path is null.", this);
return;
}
if(path.Length == 0)
{
Debug.LogError("Cannot set length because it is currently 0.", this);
return;
}
float multiplier = newLength / path.Length;
if(float.IsInfinity(multiplier) || float.IsNaN(multiplier))
{
Debug.LogError($"Cannot set length due to floating point error. Old length: {m_RestLength} New length: {newLength}", this);
return;
}
m_InterParticleDistance *= multiplier;
m_RestLength *= multiplier;
if(restLengths != null)
{
int count = restLengths.Length;
for(int i = 0; i < count; i++)
{
restLengths[i] *= multiplier;
}
}
else
{
Debug.LogError($"{nameof(restLengths)} is null. Perhaps it wasn't initialized?", this);
}
var ssData = stretchShearConstraintsData;
if(ssData != null)
{
var batches = ssData.batches;
var batchesCount = batches.Count;
for(int iBatch = 0; iBatch < batchesCount; iBatch++)
{
var batch = batches[iBatch];
var rlenList = batch.restLengths;
var rlenListCount = rlenList.count;
for(int iRest = 0; iRest < rlenListCount; iRest++)
{
rlenList[iRest] *= multiplier;
}
}
}
var dData = distanceConstraintsData;
if(dData != null)
{
var batches = dData.batches;
var batchesCount = batches.Count;
for(int iBatch = 0; iBatch < batchesCount; iBatch++)
{
var batch = batches[iBatch];
var rlenList = batch.restLengths;
var rlenListCount = rlenList.count;
for(int iRest = 0; iRest < rlenListCount; iRest++)
{
rlenList[iRest] *= multiplier;
}
}
}
}
Since I'm doing this after the rope has been made, I get the feeling I might not need to do this from the blueprint. But as far as I know this is where the "data" for the rope is stored, whereas the rope itself represents an instance. (RopeBlueprint is to Rope as Mesh is to MeshFilter/MeshRenderer)
Do I, for example, need to call ObiActorBlueprint.OnBlueprintGenerate after making this modification?
On a side note, if my analogy between blueprints and actors vs. meshes and mesh renderers is accurate, I have a suggestion: (Ignore this section if this comparison is way off.) I noticed that ObiRopeBase.cs contains a "restLength" property that is recalculated under some conditions. It seems to me that since all ropes that share the same blueprint would have the same rest length, this data should be stored and calculated inside the blueprint:- All ropes using the blueprint will have the correct restLength value automatically the next time they read the property.
- No need to recalculate the same value for multiple ropes sharing the same blueprint.
- No need to use a callback to update the rope instances using the blueprint when it changes. (I don't know to trigger these.)
- Could be useful during blueprint generation (as I had encountered before in a previous thread).
- All the data about the blueprint (and common to all ropes that share the blueprint) is organized in one location.
- The existing property can remain as a shortcut to writing rope.blueprint.restLength.
|
|
|
Precise control point editing |
Posted by: greedylamo - 26-05-2021, 07:52 AM - Forum: Obi Rope
- Replies (1)
|
 |
Hello everyone,
I am unable to find a way to move path control points to precise positions in Obi Rope 6. Previously, Obi Curve seemed to be the exact tool for that, but it seems to now be deprecated.
The current path editor only allows to move points by hand and there doesn't seem to be any exposed position values - is there some setting that I am missing?
Is there any other way to set precise control point positions without custom scripts?
Thank you!
|
|
|
Change Shape Matching Constraints at Runtime |
Posted by: richienko - 25-05-2021, 09:29 PM - Forum: Obi Softbody
- Replies (2)
|
 |
Hi,
first of all, you created amazing engine, kudos.
I'm not able to change shape matchig constraints at runtime.
My scenario: 1 solver has 1 softbody
I want to be able to change max deformation and deformation resistance at runtime. I really tried to do this based on what you write in http://obi.virtualmethodstudio.com/tutor...aints.html, but no luck.
First question -> you did write this "there's only one skin constraint per particle", where can I get info on how many actor constraints are for particle in softbody?
I tried this:
Code: var shapeConstraints = softbody.GetConstraintsByType(Oni.ConstraintType.ShapeMatching) as ObiConstraints<ObiShapeMatchingConstraintsBatch>;
var solverConstraints = softbody.solver.GetConstraintsByType(Oni.ConstraintType.ShapeMatching) as ObiConstraints<ObiShapeMatchingConstraintsBatch>;
var softbodyBatch = shapeConstraints.batches[0];
int offset = softbody.solverBatchOffsets[(int)Oni.ConstraintType.ShapeMatching][0];
for (int i = 0; i < shapeConstraints.batches.Count; i++) {
var solverBatch = solverConstraints.batches[i];
for (int j = 0; j < softbodyBatch.activeConstraintCount; ++j) {
int index = i + offset;
solverBatch.materialParameters[0] = 0.1f; //deformationResistance
solverBatch.materialParameters[4] = 0.9f; //maxDeformation
}
}
And quite few variants but, I can't get it right.
|
|
|
compile error : Ver 6.1 (24-05-2021) |
Posted by: lialear - 25-05-2021, 02:44 AM - Forum: Obi Cloth
- Replies (3)
|
 |
Unity Ver 2019.4.26f1
Assets\Obi\Scripts\Common\Solver\ObiSolver.cs(52,20): error CS0246: The type or namespace name 'ObiList<>' could not be found (are you missing a using directive or an assembly reference?)
|
|
|
|