Latest Threads |
How to dynamically change...
Forum: Obi Rope
Last Post: quent_1982
04-07-2025, 11:29 AM
» Replies: 2
» Views: 80
|
Pipeline that bends
Forum: Obi Softbody
Last Post: josemendez
04-07-2025, 09:52 AM
» Replies: 13
» Views: 773
|
How to implement/sync Obi...
Forum: Obi Rope
Last Post: quent_1982
01-07-2025, 01:48 PM
» Replies: 2
» Views: 175
|
Collisions don't work con...
Forum: Obi Rope
Last Post: chenji
27-06-2025, 03:05 AM
» Replies: 3
» Views: 246
|
Force Zone apply differen...
Forum: Obi Rope
Last Post: chenji
26-06-2025, 11:41 AM
» Replies: 11
» Views: 708
|
Can I blend in and out of...
Forum: Obi Cloth
Last Post: josemendez
24-06-2025, 04:42 PM
» Replies: 3
» Views: 234
|
Using a rigidbody/collide...
Forum: Obi Cloth
Last Post: josemendez
24-06-2025, 09:29 AM
» Replies: 1
» Views: 138
|
Solver is too performance...
Forum: Obi Rope
Last Post: quent_1982
20-06-2025, 08:09 AM
» Replies: 40
» Views: 4,194
|
Obi 7 Model Scaling
Forum: Obi Cloth
Last Post: alkis
19-06-2025, 02:37 PM
» Replies: 2
» Views: 251
|
Obi Softbody instability?
Forum: Obi Softbody
Last Post: Aroosh
18-06-2025, 06:35 PM
» Replies: 0
» Views: 133
|
|
|
ObiRope 2D + threaded rings |
Posted by: oraspec - 28-01-2019, 07:47 PM - Forum: Obi Rope
- Replies (1)
|
 |
Hi guys,
I am looking for a solution to have 2D thread with rings on it. Rings should not be attached to specific particle. It should move on a thread back and forth influenced by real physics/gravity. Can you advise whether it is possible to realize it with ObiRope for 2D without programming the threaded rings physics?
Thanks in advance.
|
|
|
Instantiate Rope during Runtime |
Posted by: crychair - 28-01-2019, 05:02 PM - Forum: Obi Rope
- Replies (3)
|
 |
Code: public void makeRope(Vector3 pos1, Vector3 pos2, GameObject obj1, GameObject obj2) {
GameObject rope = Instantiate(obiRopePrefab);
BetterRopeHelper helper = rope.GetComponent<BetterRopeHelper>();
helper.SetPoints(pos1, pos2);
helper.GenerateRope(obj1, obj2);
}
Code: using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Obi;
[RequireComponent(typeof(ObiRope))]
[RequireComponent(typeof(ObiCatmullRomCurve))]
public class BetterRopeHelper : MonoBehaviour
{
public ObiSolver solver;
public ObiRopeSection section;
public Material material;
private ObiActor actor;
private ObiRope rope;
private ObiCatmullRomCurve path;
private Vector3 start, end;
public void SetPoints(Vector3 startpoint, Vector3 endpoint)
{
// Get all needed components and interconnect them:
rope = GetComponent<ObiRope>();
path = GetComponent<ObiCatmullRomCurve>();
rope.Solver = solver;
rope.ropePath = path;
rope.section = section;
GetComponent<MeshRenderer>().material = material;
// Calculate rope start/end and direction in local space:
start = startpoint;
end = endpoint;
Vector3 localStart = startpoint;
Vector3 localEnd = endpoint;
Vector3 direction = (localEnd - localStart).normalized;
// Generate rope path:
path.controlPoints.Clear();
path.controlPoints.Add(localStart - direction);
path.controlPoints.Add(localStart);
path.controlPoints.Add(localEnd);
path.controlPoints.Add(localEnd + direction);
}
public void GenerateRope(GameObject obj1, GameObject obj2)
{
// Setup the simulation:
StartCoroutine(Setup(obj1, obj2));
}
IEnumerator Setup(GameObject obj1, GameObject obj2)
{
// Generate particles and add them to solver:
yield return StartCoroutine(rope.GeneratePhysicRepresentationForMesh());
rope.AddToSolver(null);
// Fix first and last particle in place:
//rope.invMasses[0] = 0;
//rope.invMasses[rope.UsedParticles - 1] = 0;
//Oni.SetParticleInverseMasses(solver.OniSolver, new float[] { 0 }, 1, rope.particleIndices[0]);
//Oni.SetParticleInverseMasses(solver.OniSolver, new float[] { 0 }, 1, rope.particleIndices[rope.UsedParticles - 1]);
//rope.PushDataToSolver(ParticleData.INV_MASSES);
//batchConstraints = pinConstraints.GetBatches() as ObiPinConstraintBatch;
//pinConstraints.RemoveFromSolver(null);
//Debug.Log(obj1.name);
//batchConstraints.AddConstraint(0, obj1.GetComponent<ObiCollider>(), Vector3.zero, 0f);
//batchConstraints.AddConstraint(rope.UsedParticles - 1, obj2.GetComponent<ObiCollider>(), Vector3.zero, 0f);
//pinConstraints.AddToSolver(null);
//pinConstraints.PushDataToSolver();
rope.PinConstraints.RemoveFromSolver(null);
ObiPinConstraintBatch batch = (ObiPinConstraintBatch)rope.PinConstraints.GetFirstBatch();
Vector3 offset1 = obj1.transform.InverseTransformPoint(start);
Vector3 offset2 = obj1.transform.InverseTransformPoint(start);
batch.AddConstraint(0, obj1.GetComponent<ObiCollider>(), offset1, 1f);
batch.AddConstraint(rope.UsedParticles - 1, obj2.GetComponent<ObiCollider>(), offset2, 1f);
rope.PinConstraints.AddToSolver(null);
//actor.enabled = true;
}
}
I have the method and helper above and it works. My issue is that I want the rope to be taught on instantiation rather than modifying it after. Is there some way to do this. currently when the rope is generated it become slack and weighs itself down.
Any help is appreciated.
|
|
|
Trial version? |
Posted by: JonesW - 28-01-2019, 04:33 PM - Forum: General
- No Replies
|
 |
Hi,
I'm intrigued by the assets you have created and I would like to try them out before buying.
Is there any possibility for a trial or a demo version to try out on my own?
Cheers!
|
|
|
|