Latest Threads |
Broken scripts with updat...
Forum: Obi Rope
Last Post: hariedo
21-12-2024, 10:35 AM
» Replies: 0
» Views: 47
|
Garment explodes on Andro...
Forum: Obi Cloth
Last Post: CptnFabulous
19-12-2024, 07:16 AM
» Replies: 4
» Views: 677
|
Calculating and Reproduci...
Forum: Obi Fluid
Last Post: ZacharyP
18-12-2024, 05:49 PM
» Replies: 2
» Views: 773
|
Null Reference, actor not...
Forum: Obi Rope
Last Post: josemendez
13-12-2024, 12:39 PM
» Replies: 1
» Views: 165
|
Issue with Grasping ObiRo...
Forum: Obi Rope
Last Post: josemendez
12-12-2024, 12:00 PM
» Replies: 5
» Views: 472
|
Changing extruded rendere...
Forum: Obi Rope
Last Post: aderae
10-12-2024, 07:35 PM
» Replies: 2
» Views: 246
|
Baking a rope is causing ...
Forum: Obi Rope
Last Post: josemendez
10-12-2024, 11:06 AM
» Replies: 6
» Views: 665
|
Barrier belt - changing l...
Forum: Obi Rope
Last Post: josemendez
10-12-2024, 10:42 AM
» Replies: 1
» Views: 221
|
Path editor gizmo's appea...
Forum: Obi Rope
Last Post: josemendez
10-12-2024, 09:50 AM
» Replies: 1
» Views: 219
|
Problems when using multi...
Forum: Obi Cloth
Last Post: Cat3Man
09-12-2024, 03:17 AM
» Replies: 2
» Views: 297
|
|
|
AfterShadowMapPass |
Posted by: Shreeya - 05-01-2018, 07:15 AM - Forum: Obi Cloth
- Replies (2)
|
|
Error message >> Assets/Obi/Rendering/ShadowmapExposer.cs(21,38): error CS0117: `UnityEngine.Rendering.LightEvent' does not contain a definition for `AfterShadowMapPass'
How to correct this error?
|
|
|
Obi Fluid Setup - Beginner Question |
Posted by: hmhmhm - 03-01-2018, 08:26 AM - Forum: Obi Fluid
- Replies (6)
|
|
Hello,
I'm new to Obi Fluid and in the process of getting familiar with it.
I'm trying to have a very simple 2D scene, similar to 'Simple Fluid' in the Sample Scene folder.
I start a new scene, add an Obi Emitter (with solver), and turn it 90 degrees on the x-axis so it emits downward.
I then add an empty Game Object, and add 'Rigidbody 2D', 'Box Collider 2D' and 'Obi Collider 2D (Script)' to that object. As per the instructions, I make sure the emitter and game object are in different layers.
When I run the scene, two unexpected things happen:
1. The Obi particles 'enter' the object, i.e. they don't bounce off the surface, some of them even 'fall through' the object.
2. When I switch to 3D view, and have a look from the side, I can see the particles are not remaining in the 2D plane (z=0), i.e. they move backwards and/or forward once they hit the object.
Eventually I would like to create a simple bucket and fill it with fluid in 2D. How do I best go about this, so the fluid stays a) in the 2D plane, and b) in the bucket. Also, is there an easy way to fill the bucket when the scene gets executed, i.e. without having to 'emit' the fluid into it first, which takes a while?
Thank you!
|
|
|
Mobile Optimizations |
Posted by: pstudios - 02-01-2018, 06:31 PM - Forum: Obi Fluid
- Replies (9)
|
|
Hi, I love the fluid plugin and it works great on my computer. However, on my android device which is pretty new is struggling to get through the basics of my small scale fluid animation, I would appreciate it if anyone could tell me as many steps as possible to optimize the efficiency on mobile devices (im fine with a reduction in quality as i want my project to work on as many devices as possible) any and all tips would be greatly appreciated. Thanks!
|
|
|
Problem with Final IK |
Posted by: Deschanna - 29-12-2017, 08:35 AM - Forum: Obi Cloth
- Replies (15)
|
|
Hi!
I read 'somewhere' earlier, before buying Obi Cloth, that it should work with Final IK. However, I cannot get it to work.
I am running the solver in LateUpdate.
I have a character, wearing a sash, which I'm trying to animate with Obi Cloth. It works, but problematically. With no Final IK enabled, it works as should.
However, when Final IK is enabled, the part of the sash that is tied around the character's waist and should stay under his armour, constantly jumps (shows) above the armour in parts. Sometimes more, sometimes less. And when the character is going down a hill, for example, the part that should stay in place shows above armour and noticeably jumps up and down.
Umm... some idea? Thanks.
Best regards, Laura
|
|
|
scripting ropes with pin constraints & tethers |
Posted by: phoberman - 26-12-2017, 07:43 PM - Forum: Obi Rope
- Replies (6)
|
|
Hi –
I’m working on a scene made up of hanging chains of objects, each connected by a short rope: the first particle of each rope is pinned to an object at the top, and the last particle is pinned to an object at the bottom. The first object of the first rope is set to kinematic (to anchor the whole chain at the top). It’s all working pretty well, but I have a few questions.
The final scene will have lots of ropes; each chain contains about 6 ropes, and there will be more than 20 chains in total, so that means more than 100 ropes. Putting all of this together in the editor was impractical, so I’ve written a script (based on ObiRopeHelper.cs) to help automate the process. Script included below.
When the simulation starts, the rope springs like a rubber band that’s just been let go and then settles down. I'd like to have everything begin in a resting state (unmoving). In this thread: http://obi.virtualmethodstudio.com/forum...hp?tid=175 the solution suggested is disable the rope and wait for the next FixedUpdate before reenabling. I’ve tried to implement that in my script, but it doesn’t seem to be having any effect.
Next, I would like the ropes to be as non-elastic as possible. I realize that the recommended way of doing this is via tethers, but because my ropes aren’t fixed, tethers wouldn’t seem to be an option. However, in this thread: http://obi.virtualmethodstudio.com/forum....php?tid=6 there’s a method described in which the rope is fixed, tethers are generated, then the rope is unfixed. Once again, I’ve tried to implement this in my script, but it doesn’t seem to be having any effect.
I’ve therefore tried to set the rope length by using reduced values for stretchingScale (in ObiDistanceConstraints). I’m sure this isn’t ideal, but it basically seems to work (but maybe this is causing the initial rubber band behavior?)
Finally, I’ve found that each individual rope has to have its own dedicated solver; if I try to share a single solver across multiple ropes, Unity immediately crashes. I’m guessing this has something to do with removing and adding multiple pin constraints from the solver simultaneously/asynchronously? (Just a guess). Anyway, my question is whether there will be any problems (like a performance hit) by having upwards of 100 solvers in a single scene.
Code: using UnityEngine;
using System.Collections;
namespace Obi {
[RequireComponent(typeof(ObiRope))]
[RequireComponent(typeof(ObiCatmullRomCurve))]
[RequireComponent(typeof(ObiPinConstraints))]
[RequireComponent(typeof(ObiDistanceConstraints))]
[RequireComponent(typeof(ObiTetherConstraints))]
public class ObiConnectorRope : MonoBehaviour {
public ObiSolver solver;
public ObiActor actor;
public ObiRopeSection section;
public Material material;
public float ropeLength = 1.0f; // desired rope length
public float uvYMult = 2.5f; // keep UVScale Y consistent across rope lengths
public ObiCollider upperPinObject;
public ObiCollider lowerPinObject;
private Transform point1; // offset at top of object
private Transform point2; // offset at bottom of object
private ObiRope rope;
private ObiCatmullRomCurve path;
private ObiPinConstraints pinConstraints;
private ObiPinConstraintBatch constraintsBatch;
private ObiDistanceConstraints distanceConstraints;
void Start () {
actor.enabled = false;
// move rope position to match upper pinned object
transform.position = upperPinObject.transform.position;
// 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;
// use stretching scale to set approximate rope length & UVScale Y
distanceConstraints = rope.GetComponent<ObiDistanceConstraints>();
distanceConstraints.stretchingScale = (ropeLength * 0.14f) - 0.05f; // ad hoc formula
rope.UVScale = new Vector2(1.0f, ropeLength * uvYMult);
// register offsets
point1 = upperPinObject.transform.Find("pinPointB").gameObject.transform;
point2 = lowerPinObject.transform.Find("pinPointA").gameObject.transform;
// Calculate rope start/end and direction in local space:
Vector3 localStart = transform.InverseTransformPoint(upperPinObject.transform.position);
Vector3 localEnd = transform.InverseTransformPoint(lowerPinObject.transform.position);
Vector3 direction = (localEnd-localStart).normalized;
// Add control points
path.controlPoints.Add(localStart-direction);
path.controlPoints.Add(localStart);
path.controlPoints.Add(localEnd);
path.controlPoints.Add(localEnd+direction);
// Setup the simulation:
StartCoroutine(Setup());
// Wait for next FixedUpdate
StartCoroutine(WaitOne());
actor.enabled = true;
}
IEnumerator Setup(){
// Generate particles and add them to solver:
yield return StartCoroutine(rope.GeneratePhysicRepresentationForMesh());
rope.AddToSolver(null);
// Generate tethers
// Fix first particle:
float tempMass = rope.invMasses[0];
rope.invMasses[0] = 0;
Oni.SetParticleInverseMasses(solver.OniSolver,new float[]{0},1,rope.particleIndices[0]);
rope.GenerateTethers(ObiActor.TetherType.AnchorToFixed);
// Unfix first particle:
rope.invMasses[0] = tempMass;
Oni.SetParticleInverseMasses(solver.OniSolver,new float[]{0},1,rope.particleIndices[0]);
actor.PushDataToSolver(ParticleData.INV_MASSES);
// Set pin constraints
pinConstraints = rope.GetComponent<ObiPinConstraints> ();
constraintsBatch = (ObiPinConstraintBatch)pinConstraints.GetBatches() [0];
pinConstraints.RemoveFromSolver(null);
// Add top pin constraint
constraintsBatch.AddConstraint(rope.particleIndices[rope.particleIndices[0]], upperPinObject.GetComponent<ObiCollider>(), point1.localPosition, 0f);
// Add bottom pin constraint
constraintsBatch.AddConstraint(rope.particleIndices[rope.UsedParticles-1], lowerPinObject.GetComponent<ObiCollider>(), point2.localPosition, 0f);
pinConstraints.AddToSolver(null);
pinConstraints.PushDataToSolver();
}
IEnumerator WaitOne(){
yield return new WaitForFixedUpdate();
}
}
}
|
|
|
Help with Grappling Hook Implementation |
Posted by: Cyric - 25-12-2017, 06:25 AM - Forum: Obi Rope
- Replies (1)
|
|
Hello, first off, I want to say how impressed I am with Obi Rope's performance, stability, and looks. You're doing a great job!
So I'm *attempting* to use it in a less traditional fashion to create something similar to a Grappling Hook Gun. The player fires a projectile which attaches to other objects in the scene, and the player then swings around (in 3D) using Obi Rope rigid body physics.
I'm currently stuck at even getting the projectile to fire from the "gun" with the rope attached to behave properly. I've pinned the ends of the rope to the projectile (rigidbody) and the player (rigidbody) and added a cursor to the players side.
I've done basically what's in the code below and was hoping it would do the trick, but the projectile seems to just spring back and act unpredictably. Not to mention the cursor length extension doesn't seem to keep up when used this way.
Code: bool fired = false;
void Fire()
{
fired = true;
// Add force to projectile's rigidbody
}
void FixedUpdate()
{
if(fired)
cursor.ChangeLength((gunBarrel.position - projectile.position).magnitude);
}
Before using a fired projectile, I had used similar code to create a dynamic length rope between two objects that I moved by hand in the editor and it seemed to work well enough.
Any tips on how I should go about implementing this?
|
|
|
|