22-08-2023, 01:57 PM
(This post was last modified: 22-08-2023, 01:58 PM by ShawnF.
Edit Reason: forgot link to video
)
So there's an action in my prototype that will cause a rope to lengthen so that it's usable. When this is done, I'm seeing two problems:
1) The rope gets a bit longer, but not as long as defined... until you jump on it, at which point it sort of gets "unstuck".
2) The rope doesn't seem to be simulated correctly until it gets "unstuck". This doesn't actually hurt my use case, but I thought it might be a hint about what's going on.
Here's the code I'm using for testing:
Here's a video showing the behavior that I'm talking about. You can see how the rope is using physics before it's resized, but stops reacting after the new section is added... until I jump on it and start swinging.
https://www.youtube.com/watch?v=tp34KpfQ1Ak
I can also post my janky WIP code for how the player attaches/climbs if it's useful, but I'm leaving it out for now because it's a bit long. Basically it's just moving the character to the next particle index and creating a particle group / attachment at that particle.
1) The rope gets a bit longer, but not as long as defined... until you jump on it, at which point it sort of gets "unstuck".
2) The rope doesn't seem to be simulated correctly until it gets "unstuck". This doesn't actually hurt my use case, but I thought it might be a hint about what's going on.
Here's the code I'm using for testing:
Code:
void Update()
{
if (Input.GetKeyDown(KeyCode.F12) )
{
resizeRope = true;
MainCanvasScript.instance.ShowQuickInfoMessage("Start Rope Resize", 1f);
//cursor.sourceMu = 1f; // default 0
cursor.cursorMu = 1f; // default 0; start adding rope at the end
cursor.direction = false; // default true; don't understand why, but no visible rope spools out if this is true
}
}
void FixedUpdate()
{
if (resizeRope && obiRope.restLength < resizedLength)
{
cursor.ChangeLength(obiRope.restLength + lengthAddedPerStep);
Debug.Log(obiRope.restLength);
}
if (resizeRope && obiRope.restLength >= resizedLength)
{
resizeRope = false;
MainCanvasScript.instance.ShowQuickInfoMessage("resize complete", 3f);
}
}
Here's a video showing the behavior that I'm talking about. You can see how the rope is using physics before it's resized, but stops reacting after the new section is added... until I jump on it and start swinging.
https://www.youtube.com/watch?v=tp34KpfQ1Ak
I can also post my janky WIP code for how the player attaches/climbs if it's useful, but I'm leaving it out for now because it's a bit long. Basically it's just moving the character to the next particle index and creating a particle group / attachment at that particle.