Latest Threads |
Stretching verts uniforml...
Forum: Obi Softbody
Last Post: Aroosh
Today, 05:32 AM
» Replies: 0
» Views: 61
|
Scripting rod forces
Forum: Obi Rope
Last Post: chenji
11-09-2025, 01:15 PM
» Replies: 25
» Views: 2,558
|
Burst error causing crash...
Forum: Obi Rope
Last Post: josemendez
10-09-2025, 07:03 AM
» Replies: 1
» Views: 167
|
Controlling speed of emit...
Forum: Obi Fluid
Last Post: josemendez
06-09-2025, 06:29 AM
» Replies: 1
» Views: 420
|
Looks nice on editor but ...
Forum: Obi Fluid
Last Post: josemendez
04-09-2025, 07:20 AM
» Replies: 3
» Views: 671
|
How to Shorten or Scale t...
Forum: Obi Rope
Last Post: josemendez
02-09-2025, 09:53 AM
» Replies: 5
» Views: 762
|
The Limitation of Using O...
Forum: Obi Rope
Last Post: josemendez
01-09-2025, 10:30 PM
» Replies: 1
» Views: 506
|
Bug Where a Straight Segm...
Forum: Obi Rope
Last Post: josemendez
01-09-2025, 08:46 PM
» Replies: 1
» Views: 480
|
Having an issue with obi ...
Forum: Obi Rope
Last Post: Ben_bionic
29-08-2025, 04:23 PM
» Replies: 4
» Views: 974
|
Non-uniform particle dist...
Forum: Obi Rope
Last Post: chenji
29-08-2025, 09:05 AM
» Replies: 4
» Views: 825
|
|
|
Ropes have no collision |
Posted by: Schmaniel - 08-09-2021, 10:18 PM - Forum: Obi Rope
- Replies (2)
|
 |
Good day,
I am having troubles spawning ropes from the code.
I wrote my code very similar to GrapplingHook.cs (a sample scene).
I now have the problem that the so-spawned ropes have no collision. Here is the code from that.
Any ideas where the problem could be?
Code: public void SpawnWire(Vector3 end1, Vector3 localHit)
{
// Create the rope
GameObject emptyGameObjectForOneRope = new GameObject();
emptyGameObjectForOneRope.transform.parent = this.transform;
rope = emptyGameObjectForOneRope.AddComponent<ObiRope>();
ropeRenderer = emptyGameObjectForOneRope.AddComponent<ObiRopeExtrudedRenderer>();
//ropeRenderer.section = section;
ropeRenderer.uvScale = new Vector2(1, 5);
ropeRenderer.normalizeV = true;
ropeRenderer.uvAnchor = 0;
ropeRenderer.thicknessScale = 0.5f;
rope.GetComponent<MeshRenderer>().material = material;
// Setup a blueprint for the rope:
blueprint = ScriptableObject.CreateInstance<ObiRopeBlueprint>();
blueprint.resolution = 0.5f;
blueprint.thickness = 0.5f;
blueprint.pooledParticles = 100;
// Tweak rope parameters:
rope.selfCollisions = true;
rope.surfaceCollisions = true;
rope.collisionMaterial = obiCollisionMaterial;
// Add a cursor to be able to change rope length:
cursor = emptyGameObjectForOneRope.AddComponent<ObiRopeCursor>();
cursor.cursorMu = 0;
cursor.direction = true;
////////////////////////////////////////////////////
this.end1 = end1;
this.localHit = localHit;
StartCoroutine("CoRoutineXD");
// Procedurally generate the rope path (a simple straight line):
}
public IEnumerator CoRoutineXD()
{
yield return 0;
// Procedurally generate the rope path (not quite a simple straight line, I could change it back though):
blueprint.path.Clear();
blueprint.path.AddControlPoint(end1, Vector3.back, Vector3.forward, Vector3.up, 0.1f, 0.1f, 1, 1, Color.white, "Hook start");
blueprint.path.AddControlPoint(localHit, Vector3.forward, Vector3.back, Vector3.up, 0.1f, 0.1f, 1, 1, Color.white, "Hook end");
blueprint.path.FlushEvents();
// Generate the particle representation of the rope (wait until it has finished):
yield return blueprint.Generate();
// Set the blueprint (this adds particles/constraints to the solver and starts simulating them).
rope.ropeBlueprint = blueprint;
rope.GetComponent<MeshRenderer>().enabled = true;
//
// Pin both ends of the rope (this enables two-way interaction between character and rope):
var pinConstraints = rope.GetConstraintsByType(Oni.ConstraintType.Pin) as ObiConstraints<ObiPinConstraintsBatch>;
pinConstraints.Clear();
var batch = new ObiPinConstraintsBatch();
batch.AddConstraint(rope.solverIndices[0], gameObject.GetComponent<ObiCollider>(), localHit, Quaternion.identity, 0, 0, float.PositiveInfinity);
batch.AddConstraint(rope.solverIndices[blueprint.activeParticleCount - 1], gameObject.GetComponent<ObiCollider>(),
end1, Quaternion.identity, 0, 0, float.PositiveInfinity);
batch.activeConstraintCount = 2;
pinConstraints.AddBatch(batch);
rope.SetConstraintsDirty(Oni.ConstraintType.Pin);
cursor.ChangeLength(wireLength);
|
|
|
What is the best solution for big ratio between rope and attached objects |
Posted by: Tattler - 23-08-2021, 09:23 AM - Forum: Obi Rope
- Replies (1)
|
 |
I have a scene with small boat(tug boat) which must pull a bigger ship. I try to attach both boats with obi rope. Small boat is 400 tons and the big ship is 32 000 tons. I try to create 50m rope, with less elasticity as possible. To achieve this I set particle mass to be 150kg and have around 1000 particles, which makes rope mass of 150 tons. I set distance constraint iteration to 30, set substep to 8.
With this setup when I add required force to the small boat, the rope stretches to around 60m and start pulling the big ship which is final result I want.
My questions is:
- Can I do something more to make rope less elastic with this kind of attached objects mass with way bigger ratio than 10:1.
- Can I find what force applies rope to the attached objects. Because of unrealistic heavy rope(150 tons), when I connect rope to the small boat, the rope itself start pulling small boat in his direction. If I can find what is the force of the rope, maybe can put opposite force to the small boat to balance this force and prevent small boat from moving.
Any help will be appreciated!
|
|
|
|