Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Closed loop rope, move particles to stretch it
#1
Good morning,

i am creating a simulation where everytime the game gets loaded there is an example shape around some nails an elastic has to reach. 
the elastic is represented by a closed loop obirope. 

in the start method i call a function that sets the elastic global position based on the shape. Now i woul dlike to actually move 2 or 3 particles to create the shape and hook the nails i need to
private void Start()

{
    repetition = GameManager.Instance.GetCurrentRepetition();
    Debug.Log("repetition is : " + repetition);
    SetNailsAndElastic(repetition);

}

private void SetNailsAndElastic(int repetitionNumber)
{
    GameObject[] allNails = GameObject.FindGameObjectsWithTag("Nail");
    foreach (GameObject nail in allNails)
    {
        nail.GetComponent<Renderer>().material = defaultMaterial;
    }
    switch (repetitionNumber)
    {
        case 1:
            HighlightNails(new string[] { "nail_1_r1", "nail_c_r1" });
            Debug.Log("in rep1");
            elastic.transform.position = new Vector3(-2.17000008f, 0.810000002f, -10.4899998f);
            elastic.TeleportParticle(82, new Vector3(1, 3, 5));

            //elastic.blueprint.positions[82] =  new Vector3(1, 3, 5);

}

this is a small snippet of my code, and this is what i try to do to move that specific particle for example. 
The particle doesn't move though, even if the elastic takes the right position i wrote there

do you have any advice??
Reply


Messages In This Thread
Closed loop rope, move particles to stretch it - by alicecatalano - 07-01-2025, 12:55 PM