Search Forums

(Advanced Search)

Latest Threads
Stretching verts uniforml...
Forum: Obi Softbody
Last Post: Aroosh
Yesterday, 05:32 AM
» Replies: 0
» Views: 80
Scripting rod forces
Forum: Obi Rope
Last Post: chenji
11-09-2025, 01:15 PM
» Replies: 25
» Views: 2,794
Burst error causing crash...
Forum: Obi Rope
Last Post: josemendez
10-09-2025, 07:03 AM
» Replies: 1
» Views: 196
Controlling speed of emit...
Forum: Obi Fluid
Last Post: josemendez
06-09-2025, 06:29 AM
» Replies: 1
» Views: 452
Looks nice on editor but ...
Forum: Obi Fluid
Last Post: josemendez
04-09-2025, 07:20 AM
» Replies: 3
» Views: 698
How to Shorten or Scale t...
Forum: Obi Rope
Last Post: josemendez
02-09-2025, 09:53 AM
» Replies: 5
» Views: 786
The Limitation of Using O...
Forum: Obi Rope
Last Post: josemendez
01-09-2025, 10:30 PM
» Replies: 1
» Views: 523
Bug Where a Straight Segm...
Forum: Obi Rope
Last Post: josemendez
01-09-2025, 08:46 PM
» Replies: 1
» Views: 496
Having an issue with obi ...
Forum: Obi Rope
Last Post: Ben_bionic
29-08-2025, 04:23 PM
» Replies: 4
» Views: 994
Non-uniform particle dist...
Forum: Obi Rope
Last Post: chenji
29-08-2025, 09:05 AM
» Replies: 4
» Views: 844

 
  Change particle mass via script
Posted by: leonrdo - 20-04-2018, 08:15 PM - Forum: Obi Rope - Replies (3)

Using ObiRope 3.3, I'm trying to change the mass of a single particle via script following the tutorial http://obi.virtualmethodstudio.com/tutor...icles.html
but its not working the way I think is supposed to work.
For example, calling this code, after a key is pressed,

Code:
float[] mass = new float[1];
mass[0] = 0.0f;
Oni.SetParticleInverseMasses(rope.Solver.OniSolver, mass, 1, rope.particleIndices[1]);

its not keeping the second particle fixed, as I supposed it would make.
Did I miss anything?

Thanks in advance

Print this item

  Scaling Obi Objects
Posted by: darkcser - 19-04-2018, 09:41 PM - Forum: Obi Cloth - Replies (2)

It seems like scaling objects with Obi Cloth and Obi Rope components causes issues with the simulation. What is the workflow for scaling Obi Cloth objects? Do the mesh topology and the Obi Cloth objects have to have the same scale? Does this mean I have to figure out the scale in my 3D modeller before I export to Unity? 

I had a fbx of a belt mesh that I tried to turn into an Obi Cloth object but no matter what I did with the distance constraint and distance iterations in the solver it just sagged like a super elastic silk ribbon. Eventually I realized that the belt in Unity was scaled to 0.01 so I duplicated it and scaled it to 1, and the cloth simulation looked better. Of course now I have a belt 100x bigger than desired.

Out of curiosity I followed the flag demo, and then tried to resize the flag by scaling up. It looked odd as well. (I fixed it horizontally instead of vertically, so the oddity is how it stretches the top.)

I had similar issues regarding scaling with Obi Rope that I posted in the rope section.

Print this item

  Chain Scale Issue
Posted by: darkcser - 19-04-2018, 02:10 AM - Forum: Obi Rope - Replies (2)

I'm trying to create a chain with fairly small links so that it is in scale with other objects in my VR scene. My Obi Rope resolution is already set to the max of 1 but when I reduce the link scale on the default chain link prefabs to 1, the links no longer touch one another. 

I can change the link scale so that the chain links touch each other but when I scale the  Obi Rope object itself so the chain is in scale with the rest of my scene, the rope simulation becomes very odd in that it becomes very elastic with the links being very far from one another.

Am I missing something obvious? 

Thanks.

Print this item

  Play swinging sound?
Posted by: zhuchun - 18-04-2018, 08:54 AM - Forum: Obi Rope - Replies (1)

Hi, I have a steel chain attached to an iron ball and want to play a swinging sound when it's moving. Is there anything like HingeJoint.Velocity to handle this?

Print this item

  Questions about Obi Rope
Posted by: Hypeviper - 17-04-2018, 05:38 PM - Forum: Obi Rope - Replies (2)

Hi Obi,

I have 2 questions about Obi Rope.

In the following thread http://obi.virtualmethodstudio.com/forum...hp?tid=378

You say that next platform support will be UWP and Linux, is UWP supported yet?
Because i am building something for the Hololens.


Second question:

Does the rope automaticly account for objects between the 2 points if you add them in runtime?
So it will path around those objects?


Thanks!

Print this item

  Issues with handles and scripted particles
Posted by: khalvr - 17-04-2018, 02:18 PM - Forum: Obi Rope - Replies (2)

I'm trying to make a script which snaps rope particles within a radius to their initial position on the spline, so that it places itself nicely when plugs are attached. I'm exposing the curve variable separately so that you can have two separate (identical) cords fitting to the same spot. The script works as expected when snapping to the ropes initial position, but when using the replacement cord with an overriding curve (which has a different starting position), it works well enough except with one small kink - some particles which are attached to handles will move to an area close to their starting location for the duration of the coroutine. What's even weirder is that snapping one plug into place can cause the cord on a completely different rope object (which is still a part of same cord) to exhibit this behavior with its particle handles. Once the coroutine finishes, the particles with handles will return to their expected position. 

Before you say anything - yes, this script will not work properly if you call SnapNearbyParticles twice with overlapping radii. But other than that, what am i doing wrong?



Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Obi;

public class RopeParticleSnapping : MonoBehaviour {

    protected ObiRope rope;
    public ObiCurve targetCurve;
    protected Dictionary<int, float> particleMasses = new Dictionary<int, float>();


    // Use this for initialization
    void Start()
    {
        rope = GetComponent<ObiRope>();

        if (rope != null && targetCurve == null)
            targetCurve = rope.ropePath;

        //float mu = rope.ropePath.GetMuAtLenght(interParticleDistance * i);
        //positions[i] = transform.InverseTransformPoint(rope.ropePath.transform.TransformPoint(rope.ropePath.GetPositionAt(mu)));

        /*
         * int numSegments = rope.UsedParticles - (closed ? 0:1);
if (numSegments > 0)
interParticleDistance = rope.RestLength/(rope.UsedParticles-1);
else 
interParticleDistance = 0;
         * 
         * 
         * */
    }

    public IEnumerator MoveParticles(Vector3 target, float radius)
    {
        rope.Solver.RequireRenderablePositions();
        yield return null;

        Dictionary<int, Vector3> affectedParticles = new Dictionary<int, Vector3>();

        Debug.DrawRay(target, Vector3.up*0.1f, Color.red, 10.0f);

        for (int i = 0; i < rope.positions.Length; i++)
        {
            float mu = targetCurve.GetMuAtLenght(rope.InterparticleDistance * i);
            Vector3 startPosition = targetCurve.transform.TransformPoint(targetCurve.GetPositionAt(mu));
            Debug.DrawRay(startPosition, Vector3.up*0.1f, Color.green, 10.0f);
            if (Vector3.Distance(startPosition, target) < radius)
            {
                Debug.Log("Particle " + i + " inside distance!");

                affectedParticles[i] = startPosition;
                rope.velocities[i] = Vector3.zero;
                if (!particleMasses.ContainsKey(i)) // We don't want to risk overwriting the stored mass with 0, in case of overlap!
                    particleMasses[i] = rope.invMasses[i];
                rope.invMasses[i] = 0.0f;
            }
        }
        rope.PushDataToSolver(ParticleData.INV_MASSES | ParticleData.VELOCITIES);

        while (affectedParticles.Count > 0)
        {
            List<int> remove = new List<int>();
            foreach(KeyValuePair<int, Vector3> particle in affectedParticles)
            {
                if (Vector3.Distance(rope.GetParticlePosition(particle.Key), particle.Value) < 0.001f)
                {
                    remove.Add(particle.Key);
                } else
                {
                    rope.positions[particle.Key] = rope.transform.InverseTransformPoint(Vector3.Lerp(rope.GetParticlePosition(particle.Key), particle.Value, Time.deltaTime*10.0f));
                }
            }
            foreach (int i in remove)
                affectedParticles.Remove(i);

            rope.PushDataToSolver(ParticleData.POSITIONS);
            yield return null;
        }
        rope.Solver.RelinquishRenderablePositions();
    }

    public IEnumerator UnsnapParticles(Vector3 target, float radius)
    {
        rope.Solver.RequireRenderablePositions();
        yield return null;

        for (int i = 0; i < rope.positions.Length; i++)
        {
            float mu = targetCurve.GetMuAtLenght(rope.InterparticleDistance * i);
            Vector3 startPosition = targetCurve.transform.TransformPoint(targetCurve.GetPositionAt(mu));

            if (Vector3.Distance(startPosition, target) < radius)
            {
                Debug.Log("Releasing particle!");
                particleMasses.TryGetValue(i, out rope.invMasses[i]);
                rope.velocities[i] = Vector3.zero;
            }
        }
        rope.PushDataToSolver(ParticleData.VELOCITIES | ParticleData.INV_MASSES);
        rope.Solver.RelinquishRenderablePositions();
    }

    public void SnapNearbyParticles(Vector3 target, float radius)
    {
        StartCoroutine(MoveParticles(target, radius));
    }

    public void UnsnapNearbyParticles(Vector3 target, float radius)
    {
        StartCoroutine(UnsnapParticles(target, radius));
    }
}

Print this item

  ethan soft deformation by flag
Posted by: onlyconscripted - 17-04-2018, 04:49 AM - Forum: Obi Cloth - Replies (2)

Hello

This is a brillant asset, but Im stuck trying to build something.

Im trying to duplicate the cloth asset video showing ethan from the standard assets being deformed by a flag instead of his own mesh.
I have a complex mesh and I want to use a simple hull to drive its deformation.
Ive tried building a normal cloth sim and changing the 'shared topology' but it simply overwrites the mesh filter. I haven't been able to get 2 separate objects to share or use a third cloth mesh topology object but the asset builder has demonstrated this is possible, I just can't figure out how.

Any suggestions?

Print this item

Pregunta how to move solver with local space simulation
Posted by: phields - 16-04-2018, 05:54 PM - Forum: Obi Fluid - Replies (2)

Hello, I want change solver's position in runtime to simulation a small water pool.
Is there any way to do that?

Print this item

  Applying custom forces - AddWind or AddParticleExternalForces?
Posted by: jabza - 16-04-2018, 01:39 PM - Forum: Obi Cloth - Replies (4)

Hi,

I'm generating Drag and Lift force vectors that I would like to apply directly, ideally avoiding AerodynamicConstraints.

As far as I can tell, there are two ways to apply external forces to particles: Oni.AddWind and Oni.AddParticleExternalForces.

I was wondering how these APIs differ, and when each should be used?

Finally, for this situation, should I be applying forces differently if UsesCustomExternalForces is set, what exactly does this mean?


Much appreciated.

Print this item

  iOS shader error
Posted by: rectalogic - 15-04-2018, 07:59 PM - Forum: Obi Cloth - Replies (1)

In Unity 2017.3.1f1 ObiCloth 3.4, when I build for iOS the build fails with:

Error building Player: Shader error in 'Obi/Particles': '' :  non-square matrices not supported (3x1) at Assets/Obi/Resources/ObiMaterials/ObiEllipsoids.cginc(83) (on gles)

Compiling Vertex program with DIRECTIONAL LIGHTPROBE_SH
Platform defines: UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 SHADER_API_MOBILE UNITY_HARDWARE_TIER3 UNITY_COLORSPACE_GAMMA UNITY_LIGHTMAP_DLDR_ENCODING

Print this item