Latest Threads |
Stretching verts uniforml...
Forum: Obi Softbody
Last Post: Aroosh
Today, 05:32 AM
» Replies: 0
» Views: 60
|
Scripting rod forces
Forum: Obi Rope
Last Post: chenji
11-09-2025, 01:15 PM
» Replies: 25
» Views: 2,550
|
Burst error causing crash...
Forum: Obi Rope
Last Post: josemendez
10-09-2025, 07:03 AM
» Replies: 1
» Views: 166
|
Controlling speed of emit...
Forum: Obi Fluid
Last Post: josemendez
06-09-2025, 06:29 AM
» Replies: 1
» Views: 417
|
Looks nice on editor but ...
Forum: Obi Fluid
Last Post: josemendez
04-09-2025, 07:20 AM
» Replies: 3
» Views: 670
|
How to Shorten or Scale t...
Forum: Obi Rope
Last Post: josemendez
02-09-2025, 09:53 AM
» Replies: 5
» Views: 760
|
The Limitation of Using O...
Forum: Obi Rope
Last Post: josemendez
01-09-2025, 10:30 PM
» Replies: 1
» Views: 505
|
Bug Where a Straight Segm...
Forum: Obi Rope
Last Post: josemendez
01-09-2025, 08:46 PM
» Replies: 1
» Views: 479
|
Having an issue with obi ...
Forum: Obi Rope
Last Post: Ben_bionic
29-08-2025, 04:23 PM
» Replies: 4
» Views: 972
|
Non-uniform particle dist...
Forum: Obi Rope
Last Post: chenji
29-08-2025, 09:05 AM
» Replies: 4
» Views: 825
|
|
|
Moving object along the rope |
Posted by: sodach1 - 20-12-2021, 08:57 PM - Forum: Obi Rope
- Replies (3)
|
 |
Hi guys. Can anyone give me an advice on which features to use to attach an object to a rope and move it along, like along a dynamic spline?
I wanted to use Particle Attachment and move the path point assigned in there, but as far as I understood, you can't move path points like this. So the thing is what should I do?
|
|
|
Getting Obi Rope GameObject from ObiSolver.Raycast |
Posted by: Sanppy - 20-12-2021, 05:09 PM - Forum: Obi Rope
- Replies (1)
|
 |
Hey everyone,
I'm building a game in which Obi Ropes are supposed to be interactive objects that respond to mouse clicks.
I'm using the ObiSolver.Raycast example to determine whether a mouse click hit the rope and I'm able to get a QueryResult that seems to be correct for the relevant rope.
What I'm lacking is the next step in the process, and that is to get the GameObject associated with the QueryResult I got, e.g: the Obi Rope object.
Is there any way of doing that?
Just to give you an idea, here's my current code, based on the example, that uses the mouse position and successfully returns a relevant QueryResult
Code: if (Input.GetMouseButton(0))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
Debug.Log("X: " + ray.origin.x + "Y: " + ray.origin.y + "Z: " + ray.origin.z);
Debug.DrawRay(ray.origin, ray.direction * 1000);
int filter = ObiUtils.MakeFilter(ObiUtils.CollideWithEverything, 0);
// perform a raycast, check if it hit anything:
if (obiSolver.Raycast(ray, out QueryResult result, filter, 50, 0.1f))
{
// get the start and size of the simplex that was hit:
int simplexStart = obiSolver.simplexCounts.GetSimplexStartAndSize(result.simplexIndex, out int simplexSize);
// Debug draw the simplex:
for (int i = 0; i < simplexSize; ++i)
{
int particleIndex = obiSolver.simplices[simplexStart + i];
Vector3 pos = obiSolver.transform.TransformPoint(obiSolver.positions[particleIndex]);
Debug.DrawRay(pos, Vector3.up * 1000, Color.yellow);
}
}
}
Thank you.
OK so I think I actually find out how to do it, essentially by using simplexStart, using it to find the particleIndex, and finally, using "particleToActor" with the particleIndex to fetch the ObiRope GameObject.
Here's how my current code looks like:
Code: if (Input.GetMouseButton(0))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
Debug.Log("X: " + ray.origin.x + "Y: " + ray.origin.y + "Z: " + ray.origin.z);
Debug.DrawRay(ray.origin, ray.direction * 1000);
int filter = ObiUtils.MakeFilter(ObiUtils.CollideWithEverything, 0);
// perform a raycast, check if it hit anything:
if (obiSolver.Raycast(ray, out QueryResult result, filter, 50, 0.1f))
{
//obiSolver.particleToActor
// get the start and size of the simplex that was hit:
int simplexStart = obiSolver.simplexCounts.GetSimplexStartAndSize(result.simplexIndex, out int simplexSize);
int particleIndex = obiSolver.simplices[simplexStart];
ObiRope rope = obiSolver.particleToActor[particleIndex].actor as ObiRope;
}
I'm not sure if this is the optimal method. If Anyone has a better suggestion, I'd love to know about it.
Thanks.
|
|
|
Fluids not recognizing holes in terrains |
Posted by: Softscale - 20-12-2021, 11:28 AM - Forum: Obi Fluid
- Replies (1)
|
 |
I've got a regular Unity terrain in my game world, with a Terrain Collider and Obi Collider, and fluid collision works fine in most places - but in one part, there is a hole cut in the terrain for a cave mesh. I've noticed that fluids won't cross the threshold where the hole in the terrain was painted, and any fluids created inside the cave (below where the terrain would be) are immediately forced upward/outward to the surface of the terrain.
I did find a workaround that works for my use case (disable the ObiCollider on the terrain when in the cave) but I'm wondering if there is a better solution for being below a terrain. Thanks.
|
|
|
Spatial Query on multiple Actors |
Posted by: cgwill - 20-12-2021, 09:35 AM - Forum: General
- Replies (2)
|
 |
Hello,
i have recently started to work with the Obi Package (Rope/Cloth) and am running in some trouble. It is probably a pretty simple fix/problem but i simply am unable to figure it out myself. I used the code example for spatial query which is working really perfectly as long as only one actor is in the solver. As soon as multiple actors from the same type are in the solver the position data is calculated wrong. It stays correct with the last actor in the solver though, which i find curious.
Code: using UnityEngine;
using Obi;
public class DistanceToPoint : MonoBehaviour
{
public ObiSolver solver;
public float radius = 1;
void Update()
{
int filter = ObiUtils.MakeFilter(ObiUtils.CollideWithEverything, 0);
var query = new QueryShape(QueryShape.QueryType.Sphere, Vector3.zero, Vector3.zero, 0, radius, filter);
var xform = new AffineTransform(transform.position, transform.rotation, transform.localScale);
QueryResult[] results = solver.SpatialQuery(query, xform);
// Iterate over results and draw their distance to the point.
// We're assuming the solver only contains 0-simplices (particles).
for (int i = 0; i < results.Length; ++i)
{
if (results[i].distance < radius)
{
Vector3 pos = solver.transform.TransformPoint(solver.positions[results[i].simplexIndex]);
Debug.DrawLine(transform.position, pos, Color.yellow);
}
}
}
}
Here is a GIF of the problem
Any suggestions why this might be? Does this concern the info in the example code (We're assuming the solver only contains 0-simplices (particles))?
A follow up question would be. I plan on using multiple solvers with multiple actors in my scene and would keep the performance overhead low. What would be the best query method to check which actor/particles are near. Is the spatial query method suited for this purpose?
Any help would be highly appreciated 
Best regards, Will
|
|
|
Not displayed in scene |
Posted by: kbtit - 17-12-2021, 09:04 AM - Forum: Obi Fluid
- Replies (2)
|
 |
I was able to eject a Particele using Solver and Emitter.
Now I want to eject more than one Particele, so I duplicate the Solver and Emitter.
The Particele is ejected, but not displayed in GameView, and not displayed in ScneView before duplication.
How do I get the Particele to show up in GameView and ScneView?
|
|
|
Should I use Cloth or Rope package? |
Posted by: jingato - 17-12-2021, 05:04 AM - Forum: General
- Replies (2)
|
 |
Hi. I have a simple basketball game and I want to add some physics to the net when the ball interacts with it, including going in the hoop and out the net. My net consists of a single mesh and uses a texture with alpha to make it look like rope. To achieve this, would it be better to use the cloth package or the rope package? Also, would one perform better than the other for this use case. It will need to run on the Oculus Quest 2, which isn't all that powerful. Is that achievable?
Thanks
John
|
|
|
|