So if you want to increase strain, all you need to do is reduce the rope's rest length so that it is a percentage of the length between the points it is attached to. You can use a cursor to do that, like this:
Code:
cursor.ChangeLength(Vector3.Distance(attachmentA, attachmentB) * 0.6f); //rope is 40% shorter than the distance between its endpoints.
21-10-2021, 08:18 AM (This post was last modified: 21-10-2021, 08:34 AM by josemendez.)
(21-10-2021, 02:36 AM)sangku2000 Wrote: It not changing a component but a code?
Yes, you need to write some code for this to work.
(21-10-2021, 02:36 AM)sangku2000 Wrote: And than, what script?
Your own script, you need to write a script that calls cursor.ChangeLength(yourNewLength), where "cursor" is a variable of type ObiCursor.
(21-10-2021, 02:36 AM)sangku2000 Wrote: I've searched all scripts using a keyword "cursor.ChangeLength" but, i only found ObiRopeCursor.cs ....is it correct to change this cs file??
Im a bit confused by this question...you don't have to change ObiRopeCursor.cs or any other Obi script, if you do you can break the asset.
ChangeLength() is a public method exposed by ObiRopeCursor. You simply add a ObiRopeCursor component to your rope, and then call its ChangeLength() method in your own script. Take a look at the manual for an in-depth explanation and some sample code: http://obi.virtualmethodstudio.com/manua...ursor.html
Note C# scripting skills are an absolute requirement to be able to use Obi, if you're unfamiliar with scripting/programming you'll find it very hard to use. See our FAQ: http://obi.virtualmethodstudio.com/faq.html
Quote:Is scripting / coding required to use Obi?
For anything except the bare basics, yes. Obi is written in HPCS (high performance C#) and C++11, and it exposes a C# API. Obi deals with hundreds of particles and thousands of constraints every frame. These are exposed to you, the user, so learning how to write performant code is a prerequisite.
22-10-2021, 07:21 AM (This post was last modified: 22-10-2021, 07:49 AM by josemendez.)
(22-10-2021, 04:07 AM)sangku2000 Wrote: cursor.ChangeLength(Vector3.Distance(attachmentStart.transform.position, attachmentEnd.transform.position) * distanceRate * Time.deltaTime);
// length is adjusted by rate and time.
}
But.... I think self collider is seem to be not working...
Do not multiply by Time.deltaTime, it does not make any sense in this context. You're not changing the length over time, you're just setting it to a specific value. Multiplying by Time.deltaTime (which is a very, very small value, like 0.001) will set the length of your rope to be pretty much zero. This will result in a rope made of only two particles: one at each end. So no collisions will take place since there are no particles to collide with.
(22-10-2021, 04:07 AM)sangku2000 Wrote: I think i need to recalculate the element.. is right?
Assuming the rope does contain enough particles and there's no large gaps in between them, there's other issues that can prevent accurate collision detection:
- Make sure particle collision constraints are enabled in the solver: http://obi.virtualmethodstudio.com/manua...olver.html
- Make sure collision filters are properly set up. By default, ropes collide with everything, so unless you've changed this or you've reused a blueprint that had incorrect filter settings, it should work fine. For info on collision filters, see:http://obi.virtualmethodstudio.com/manual/6.2/collisions.html
- If your ropes are very tense, then gaps can appear in between particles, allowing ropes to pass trough each other. Using surface collisions can improve this. See: http://obi.virtualmethodstudio.com/manua...sions.html
You mention your distanceRate variable is 0.1, that will make the rope 10% of the distance between its ends and will likely open huge gaps in between particles. I don't think you need such large tension, any real-world rope or chain would snap under such strain. distanceRate is meant to be set to 0.8-0.99, or some value close to 1.
(22-10-2021, 09:19 AM)sangku2000 Wrote: In this situation, I need to recalculate rope's particles or make own particles??
No need to. Ropes will readily collide with each other, as long as they're correctly setup.
(22-10-2021, 09:19 AM)sangku2000 Wrote: Sorry... very very sorry....
No worries! answering questions is what I'm here for