Hi guys!
I’m doing some Technical Artist exercises. I’m trying to recreate what caught my attention in the new game state video of Hogwarts Legacy.
I’m trying to re-build objects that are already fractured-> I have 1 gameobject “Broken_bridge”, and inside of this one, there are the broken pieces (lots of game objects).
I use Bezier curves, so every broken piece has a trajectory with 50 points (Vector3), and I want to do a Lerp for all the fractured gameobjects.
The problem is that when I hit play, I only can see the ending of the Lerp movement. All the fractured pieces are almost in the final place… But I want them to follow my Bezier curve.
This for loop should work. But I don’t know what’s wrong with using Lerps in a For loop. Help please.
void Update()
{
DrawAllMovementCurves();
//Move broken meshes (create function later)
//float distCovered = (Time.time - startTime) * speed;
for (int i = 0 ; i < instantiatedBrokenMeshes.Count ; i++)
{
float distCovered = (Time.time - startTime) * speed;
float fractionOfJourney = distCovered / journeyLenghtList[i];
for (int j = 0; j < 49; j++)
{
instantiatedBrokenMeshes[i].transform.position = Vector3.Lerp(myCurves[i].positions[j], myCurves[i].positions[j + 1], fractionOfJourney);
instantiatedBrokenMeshes[i].transform.rotation = rotationsFromBrokenMeshes[i];
}
}
}

