Latest Threads |
Broken scripts with updat...
Forum: Obi Rope
Last Post: hariedo
23-12-2024, 05:44 PM
» Replies: 2
» Views: 160
|
Garment explodes on Andro...
Forum: Obi Cloth
Last Post: CptnFabulous
19-12-2024, 07:16 AM
» Replies: 4
» Views: 695
|
Calculating and Reproduci...
Forum: Obi Fluid
Last Post: ZacharyP
18-12-2024, 05:49 PM
» Replies: 2
» Views: 797
|
Null Reference, actor not...
Forum: Obi Rope
Last Post: josemendez
13-12-2024, 12:39 PM
» Replies: 1
» Views: 196
|
Issue with Grasping ObiRo...
Forum: Obi Rope
Last Post: josemendez
12-12-2024, 12:00 PM
» Replies: 5
» Views: 520
|
Changing extruded rendere...
Forum: Obi Rope
Last Post: aderae
10-12-2024, 07:35 PM
» Replies: 2
» Views: 273
|
Baking a rope is causing ...
Forum: Obi Rope
Last Post: josemendez
10-12-2024, 11:06 AM
» Replies: 6
» Views: 696
|
Barrier belt - changing l...
Forum: Obi Rope
Last Post: josemendez
10-12-2024, 10:42 AM
» Replies: 1
» Views: 244
|
Path editor gizmo's appea...
Forum: Obi Rope
Last Post: josemendez
10-12-2024, 09:50 AM
» Replies: 1
» Views: 239
|
Problems when using multi...
Forum: Obi Cloth
Last Post: Cat3Man
09-12-2024, 03:17 AM
» Replies: 2
» Views: 321
|
|
|
Rope "drag" and PullDataFromSolver |
Posted by: Agrerim - 17-05-2018, 10:35 PM - Forum: Obi Rope
- Replies (1)
|
|
Hi!
I'm using Obi for a 3D grappling hook function (similar to you 2D example, but in 3D).
I have tweaked the values for the weight of my player rigidbody, for the rope and for the ObiSolver a lot, and I'm beginning to be pretty happy with the result. I still have one big problem:
If my player comes with some speed and shoots the rope in front of her, she still has some speed forward. This means she moves a bit while the rope is generated (whic takes around 3 frames on my computer). This I've tried to compensate for by creating a proportionally smaller rope. Also the rope is generated still (i.e. with no velocity), while she is in movement. The result is that the rope, when it appears, is formning a backward bend, behind her, and starts to slow her down from some kind of drag.
I first guessed this drag was because of some constraints, so I minimized bend constraint and increased "slack" to maximum. This made the rope a bit more "ugly", because it bent too much, but still no huge improvement. So I thought perhaps the player had too little mass to drag the rope. I increased the mass from 1 to 10, and it helped a bit, but instead the rope acted more elastic. Also, I want other objects to be much heavier than the player, so I don't like to have her too heavy. I changed that back, and came up with the idea, that perhaps I just need to set the particles start speed to the same as the player from the beginning! This way, they shouldn't drag behind her and slow her down.
The problem is that this seems to cause som unpredicted results. For one, the whole rope seemed to get a little bit crazy (but perhaps this is something I can tweak). But the other problem is that the fixed particle which keeps the far end of the rope in place, starts moving too. I read on this forum that this may be because even a particle with inverse mass 0 will move, if you set its velocity to some value. So I tried to exclude this particle, by getting the mass of all particles and avoid giving velocity to the one with inverseMass > 0.
Strangely, if I Debug.Log () all the particle masses I don't get any one with a different mass. They all have mass 10.
Code: float[] masses = new float[1];
masses[0] = 0;
Oni.SetParticleInverseMasses (rope.Solver.OniSolver, masses, 1, rope.particleIndices[rope.UsedParticles - 1]);
// The above part works in game!
rope.TetherConstraints.RemoveFromSolver (null);
rope.GenerateTethers (ObiActor.TetherType.AnchorToFixed);
rope.TetherConstraints.AddToSolver (null);
// The above part, I'm not sure if it works. Sometimes the rope does not seem to be thethered. Is it correct? I can't see tethers in the editor.
// Set start velocity of particles:
Vector3 velocity = GetCurrentVelocity ();
yield return 0; // I added this row, just in case the SetParticleInverseMasses needs a frame to take effect.
rope.PullDataFromSolver(ParticleData.VELOCITIES | ParticleData.INV_MASSES);
if (rope.isActiveAndEnabled && rope.InSolver)
{
for (int i = 0; i < rope.velocities.Length; i++) // (I noticed you use ++i - why? Does that not increment before running the first loop?)
{
if (rope.invMasses[i] > 0.01)
rope.velocities[i] = velocity;
Debug.Log ("Particle " + i + " has mass " + rope.invMasses[i]);
}
rope.PushDataToSolver(ParticleData.VELOCITIES);
}
For a short rope, with just 3 particles, this gives the result:
Code: Particle 0 has mass 10
Particle 1 has mass 10
Particle 2 has mass 10
Particle 3 has mass 10
Particle 4 has mass 10
Particle 5 has mass 10
Particle 6 has mass 10
Particle 7 has mass 10
Particle 8 has mass 10
Particle 9 has mass 10
Particle 10 has mass 10
Particle 11 has mass 10
Particle 12 has mass 10
I guess the 10 extra particles are the pooled ones, not in use at the moment? But why is there no one with another mass?
As you see in my code, I even tried adding a "yield return 0", just in case it takes a frame for the fixed particles mass-change to take effect.
The fixed particle does work as expected and is completely still in the game, so the player can hang from it. If I visualize it in the editor (during paused game), however, it says it has a mass of 0.1.
I can't get my head around this! Do you have any idea?
Perhaps another solution would be to lower the mass of all particles to 0,01? But I do think giving them a start speed would work best, and be most realistic. Perhaps a start speed which varies gradually from the players speed in the player-end and 0 in the stuck end. Or do you have another idea for how to prevent this?
Cheers,
Rasmus
|
|
|
How to select the obi rope by mouse click? |
Posted by: cowill - 17-05-2018, 02:58 AM - Forum: Obi Rope
- Replies (4)
|
|
Hi, everyone. I create some obi ropes in my game, then I need select them by mouse click (Input.GetMouseButtonDown) in game window, such like using Physics.Raycast to know whether mouse click on the rope , however the conventional way does not work . Any one help to solve this problem? Thanks a lot.
|
|
|
Obi cloth does not properly work for models stitched to an existing skeleton. |
Posted by: cubrman - 13-05-2018, 06:03 PM - Forum: Obi Cloth
- Replies (33)
|
|
I "stitch" newly created skinned models for my main character to an existing skeleton in my Unity project using a script. That is the only way I know how to attach a new model to my skeletaly animated character. Unfortunately adding Obi cloth to such models makes the plugin work with bugs: editing points gets bugged because the plugin thinks that the points are still located where the initial cloth GameObject was, assigning parameters to points is impossible and I am pretty sure self-collision with other skinned meshes on the recipient skeleton is not working either. I have created a Unity 2017.2 project with a scene that has everything set up for stitching a model to an existing skeleton, to stitch the model - just right click on a "Stitcher editor" script located on a "Shirt" GameObject in the "Bug scene" ("Scenes/Bug scene") and choose "Stitch skinned mesh".
Link to a screenshot:
http://piccy.info/view3/12327021/da782b2...7d9e60eb3/
Link to the project:
https://drive.google.com/open?id=178A31T...j7r--g8qNf
Please try it out and tell me if there is a workaround for such case.
P.S. Jesus guys this forum tech is a mess. I had to attach my file from the google drive and screenshots are impossible to embed. Such a shame to have such poor forum for a HQ product like Obi.
|
|
|
Collision with my character won't work. |
Posted by: Skweejji - 13-05-2018, 05:14 AM - Forum: Obi Cloth
- Replies (1)
|
|
I can't for the life of me get my collision to work with my character. I have a cloak on the character that is using Obi Cloth. Collisions are enabled in my solver, my collider is on a seperate layer from my cloth, I have the correct layer selected in my solver for collisions. I need saving.
|
|
|
Rope lenght on demand |
Posted by: Jimess - 09-05-2018, 05:40 PM - Forum: Obi Rope
- Replies (2)
|
|
Hi,
Bought this tool recently for a single straightforward task - I want my rope to extend on demand (i.e. when you shoot a harpoon, I want the rope to follow the tip until the rope's maximum lenght is reached).
Right now I've played quite a lot with Obi Rope but the ChangeLenght method just can't keep up with my "tip" object. Whenever I shoot the object it feels like the rope just drasticly stops my gameobject. Doesn't matter how often I call the change length method.
So my question - is there any way to achieve the "extend on demand" effect with Obi Rope?
|
|
|
|