Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Some questions & requests
#3
‘josemendez’ Wrote:I assume your use case is to re-attach an existing rope to some other object, not creating a new rope between two points, correct? I ask this because re-attaching the rope will not change its rest length: if the two objects are further apart than the length of the rope, the rope will stretch.

Just tried your code, and it works fine for me. Setting the position of the particles and then setting the attachment targets is the correct way to do it. If it works right after instantiating the rope, I don’t see any reason for it not to work later. Could you share a bit more about the context in which you’re doing this?

Yes, that’s the case. In fact, what I’m really doing is: I have a dynamic Pooling System of ropes. When I’m spawning a fresh one (coming from Instantiate) it works just fine. But if it is coming from the pool (a disabled object in the scene) the attachment works, but the rope is misplaced.
If I do the usual Instantiate/Destroy it works just fine as well. So I was assuming the problem is with re-attaching ropes, but I should have mention that it is not exactly the case. Sorry for that!  Lengua
Anyway I still don’t know how to solve this, I want to figure out how to handle the issue instead of going with the simplest solution of not using pool, because I might face something similar in future stages of the project.

‘josemendez’ Wrote:- There’s comparatively heavy objects attached to them (for instance, a 100 kg object hanging from a 10 grams rope). Iterative solvers have a hard time dealing with large mass ratios, so keep them low (1:10 max)

Yes, that’s precisely the case. Lengua The ropes are very stretchy because they are attached to heavy objects.

‘josemendez’ Wrote:All actors have a Teleport(position, rotation) function. You can call that, or if you want to do it yourself you need to set the particle’s previous positions and interpolated positions as well:
If you want to reset the particles to their starting position (the one set in the blueprint), you can also call ResetParticles().

Tried everything but it’s still not working when it comes from the pool.

‘josemendez’ Wrote:Obi uses Unity’s FixedUpdate() by default, so it is affected by Time.timeScale.

If you see in the official Unity’s documentation about changing Time.timeScale: https://docs.unity3d.com/ScriptReference...Scale.html
They do like this:

Code:
if (Time.timeScale == 1.0f)
    Time.timeScale = 0.7f;
else
    Time.timeScale = 1.0f;
// Adjust fixed delta time according to timescale
// The fixed delta time will now be 0.02 real-time seconds per frame
Time.fixedDeltaTime = this.fixedDeltaTime * Time.timeScale;

And that’s what I’m doing as well, because only changing the Time.timeScale without changing Time.fixedDeltaTime makes the physics based objects have a not very smooth slow motion.
And it seems that doing so makes the ObiRope simulation operates in “normal time”. Is that correct? There is a workaround for it?

‘josemendez’ Wrote:I haven’t received any similar reports, could you provide some steps to reproduce this? The line the error refers to looks like this:

Yes, this is what I’m doing:

Code:
_ropeReturnTween = DOVirtual.Float(_rope.Length, 0f, 0.1f, UpdateRopeLength);
void UpdateRopeLength(float value) => _rope.SetLength(value);

The only thing I have inside the SetLength is:

Code:
_cursor.ChangeLength(Mathf.Min(length, _maxLength));

So basically, a tween transition from the rope’s restLength to 0 with a duration of 0.1 seconds. Sometimes, not always, doing it triggers this mentioned ArgumentOutOfRange exception.

Thank you very much for the fast reply!
Reply


Messages In This Thread
Some questions & requests - by landosilva - 04-08-2022, 10:58 PM
RE: Some questions & requests - by josemendez - 05-08-2022, 07:57 AM
RE: Some questions & requests - by landosilva - 05-08-2022, 03:34 PM
RE: Some questions & requests - by josemendez - 05-08-2022, 04:17 PM
RE: Some questions & requests - by landosilva - 06-08-2022, 02:59 PM
RE: Some questions & requests - by josemendez - 08-08-2022, 07:44 AM
RE: Some questions & requests - by landosilva - 08-08-2022, 09:46 AM
RE: Some questions & requests - by josemendez - 08-08-2022, 10:54 AM
RE: Some questions & requests - by landosilva - 08-08-2022, 02:09 PM
RE: Some questions & requests - by josemendez - 08-08-2022, 02:24 PM
RE: Some questions & requests - by landosilva - 08-08-2022, 02:56 PM
RE: Some questions & requests - by josemendez - 08-08-2022, 03:21 PM
RE: Some questions & requests - by landosilva - 08-08-2022, 03:44 PM
RE: Some questions & requests - by josemendez - 08-08-2022, 03:46 PM
RE: Some questions & requests - by landosilva - 09-08-2022, 04:51 PM
RE: Some questions & requests - by josemendez - 10-08-2022, 07:18 AM
RE: Some questions & requests - by landosilva - 10-08-2022, 10:03 AM
RE: Some questions & requests - by josemendez - 10-08-2022, 10:15 AM
RE: Some questions & requests - by josemendez - 10-08-2022, 10:39 AM