The documentation for cloth proxies says that they should be usable with either skinned cloths or normal cloths, however from looking at the code it seems like it's being driven from the MeshFilter component, which isn't a requirement of the SkinnedMeshRenderer.
is there an alternative?
Edit: Additionally, this cloth solution doesn't have a clear way of how to manage LODGroups. The results seem to be that any cloth will always be visible, breaking the lodgroup
As shown in the figure below, I try to use two soft bodies to grab a rigid body. For example, a claw machine.I expect the grabbing process to be achieved through friction.
I set the same collision material for both the claw soft body and the rigid body, with both dynamic and static friction set to 1.
In my attempt, I was able to grab the rigid body, but it soon fell slowly. In the real world, I would think that the friction is not enough. But I have set the friction to 1 in the collision material, and I expect that there should be no tangential movement of the object.
For reference I have attached my Obi Solver component configuration, although I have tried different things with it and I don't think the problem seems to be there.
Is it possible to achieve my needs based on ObiSoftbody? If it is feasible, I am very much looking forward to getting suggestions from developers.
Many thanks!
Please see the attachment for detailed configuration.
Thanks!
Any guide or example on making a rope that works like a helicopter hook, ie bit like the jungle strike games.. where the end of the hook can latch onto gameobjects to pick them and swing them, but also hoist them up so the rope length would get shorter?
is this something simple that can be done with obi rope?
I've a rope around 1 unit long, it's attached to a rod by the first and last particle with 2 static particle attachments.
On this rope there is cursor, depending on an object position (a VR controller) the cursor will either have the cursor at 0 or 1 (source always at .5) . Imagine you are pulling a rope either from the start or end.
So this rope can get bigger if you pull, everything works fine here.
Now when pulling I want to attach the closest particle from the controller to it. I'm getting the closest particle (avoiding the first and last) and create the attachment using this script:
And the behavior is weird, sometimes it works, sometimes points get stuck in the air like if they were attach to a world position. I feel like it's because I'm expanding the rope while dragging and sometimes the source particle can become the one attached?
I want to simulate human soft tissues through the ObiSoftbody toolkit.
I have two questions, both of which do not consider plastic deformation, but only elastic deformation:
① How to modify the elastic deformation effect of the soft body. For example, the elasticity of fat is different from that of muscle. I modified the Shape Matching Constraints in the test, but the effect does not seem to meet expectations.
② I want to simulate the elasticity value of each soft tissue, so I am considering obtaining the deformation of each particle through the API for calculation. Is my idea correct?
Thank you for your attention, I really want to know how to do my work, thank you.
Sorry to bother you. I want to create a system where when a cloth net collides with a rigid body, it indicates whether a collision has occurred. If a collision occurs, the scene should be reinitialized. However, with the current code, even though collisions appear to happen on screen, there is no indication of a collision being detected.
Here is the code attached to the obi solver,
Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Obi;
[RequireComponent(typeof(ObiSolver))]
public class CollisionEventHandlerchuang : MonoBehaviour
{
ObiSolver solver;
public int contactCount;
private bool collisionOccurred = false;
// just iterate over all contacts in the current frame:
foreach (Oni.Contact contact in e.contacts)
{
// if this one is an actual collision:
Debug.Log("no bang chuang");
if (contact.distance < 0.01)
{
ObiColliderBase col = world.colliderHandles[contact.bodyB].owner;
if (col != null)
{
Debug.Log("bang chuang");
collisionOccurred = true;
contactCount++;
}
}
}
}
public bool IsCollisionOccurred()
{
return collisionOccurred;
}
public int GetContactCount()
{
return contactCount;
}
if (collisionHandlerchuang == null)
{
Debug.LogError("CollisionEventHandlerchuang not found in the scene.");
}
if (collisionHandler == null)
{
Debug.LogError("CollisionEventHandler not found in the scene.");
}
}
void FixedUpdate()
{
if (collisionHandlerchuang != null)
{
bool collisionOccurred = collisionHandlerchuang.IsCollisionOccurred();
int contactCount = collisionHandlerchuang.GetContactCount();
Dev environment: Obi Rope version 6.5.4 / Windows 10 / Unity 2021
Hello, sorry to bother you. I am working on a puzzle game and need to save the data of twisted ropes into a JSON file, then read the JSON during gameplay to restore the ropes to their previous twisted state. ()
I have implemented the save and load functions and can confirm that the saved data is correct because I have tested the vectors' paths of the ropes, and they match what was saved.
However, when I apply the data to the instantiated ropes, I cannot restore the ropes to their previous state. When I use the vectors stored in JSON to restore the positions of the rope's particles, the ropes can never maintain their previous twissted state. The ropes are always spread out or lying there alone.
I found some posts in the forum:
https://obi.virtualmethodstudio.com/foru...-116.html?
The first post from 2017 mentioned frequently calling ObiRopeCursor.ChangeLength() to restore the shape of the ropes, but this method does not work for me, and I am also unable to call the PushDataToSolver method mentioned in the post. (This method only implemented in class ObiStitcher) However, I understand the reason for calling ObiRopeCursor.ChangeLength(). Calling this method can increase the activeParticleCount. The number of actor.activeParticleCount may be much smaller than the number of actor.particleCount, but the number of actor.particleCount is limited by the particleCount in ObiActorBlueprint.
https://obi.virtualmethodstudio.com/foru...4112.html?
The second post was updated in February 2024, which is very recent and provides sample code. The save and load code in the post is very similar to mine, with the only difference being that the loop code during restoration ignores the legality of solver.positions[particlesIndices[i]]. During actual operation, the number of _rope.solverIndices may be much smaller than the total amount of data stored in JSON, resulting in either loss of some data or array out-of-bounds errors.
Here is the code I used to instantiate the rope / saving and restoring the ropes.
JSONObject GetRopeParticleData()
{
var rope = gameObject.GetComponent<ObiRope>();
var solver = rope.solver;
var particlesIndices = rope.solverIndices;
var positions = new List<Vector3>();
for (int i = 0; i < particlesIndices.Length; i++)
{
//if (rope.IsParticleActive(i)) // I was considering save active particles only.
{
positions.Add(solver.positions[particlesIndices[i]]);
}
}
var positionsArray = JSONObject.emptyArray;
for (int i = 0; i < positions.Count; i++)
{
positionsArray.Add((JSONNode)positions[i]);
}
var ropeObject = JSONObject.emptyObject;
ropeObject.AddField("positions", positionsArray);
//ropeObject.AddField("velocities", velocitiesArray); // Velocities are all zero, so I didn't save.
return ropeObject;
}
Load the positions of the particles from JSON and set to particles in the rope:
public void Actor_OnBlueprintLoaded(ObiActor actor, ObiActorBlueprint blueprint)
{
if (particleDataToRestore == null)
return;
var solver = actor.solver;
var particlesIndices = actor.solverIndices;
/*for (int i = 0; i < actor.solverIndices.Length; ++i)
solver.invMasses[actor.solverIndices[i]] = 0;*/
var positionsJsonArray = particleDataToRestore["positions"];
if (positionsJsonArray != null && positionsJsonArray.type == JSONObject.Type.Array)
{
for (int i = 0; i < positionsJsonArray.list.Count; i++)
{
if (i < particlesIndices.Length)
{
solver.positions[particlesIndices[i]] = positionsJsonArray[i].ToVector3();
// actor.ActivateParticle(i);
}
}
}
/*for (int i = 0; i < actor.solverIndices.Length; ++i)
solver.invMasses[actor.solverIndices[i]] = 1f;*/
In this post https://obi.virtualmethodstudio.com/foru...-3520.html you helped Locque create particles with a solid white color using the Built-In Pipeline.
But how can I do this in URP?
I tried taking the shader file you gave him and splicing the changes into a copy of ParticleShaderURP.shader but couldn't get it to work.
The pipelines are just too different.
I'm new to ObiFluid and I'm currently working on a 2D bartender game where you can grab glasses with fluid, move them around and pour the fluids into other glasses (or onto the shelves).
For example, I'd like this to work:
Drag and drop the red fluid glass from below through the upper shelf collider and through the blue and green glasses without affecting the liquids at all - it should just pass through it.
Rotate the red fluid glass so the red fluid pours out. Once the red fluid has left its glass it should be stopped by any other glass (i.e. fill those glasses and mix with any fluids inside) or the shelf.
So, in short, I'd need a *grabbed glass with liquid* ignore all non-grabbed-glass colliders/liquids, and *liquid that has left a grabbed glass* to normally interact with the world.
Liquids can mix, so I don't think I could do anything like "liquid from the red emitter behaves differently" - it might be glass mixed with red and blue liquid that is grabbed, while other glasses also already have red or blue liquid.
I see two ways this could happen:
If I make the simulation 3D with very flat models, it would still look 2D in an orthographic camera and I could use the Z-axis to make a grabbed glass and its contents ignore any other collider. When the fluid leaves the grabbed glass trigger volume because it is poured I could adjust the Z-position of those now-outside-the-glass fluid particles back to the Z-position that everything non-grabbed is on.
If there is a way to have multiple simulations and to transfer colliders/fluids between simulations, I could temporary make a grabbed glass and its fluid a separate "grabbed glass" simulation and return any fluid that leaves the grabbed glass to the "main" simulation.
Do those ways sound possible? Is there any other (maybe better?) way to achieve this?