Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Cant change rope position on instantiate
#1
Hi,
I instantiate ropes in game but can't change position of them on instantiate and they appear on where they are supposed to be and then stuck. I change start and end particle attachment positions plus rope transform position
I am using the code below

Code:
    Rope newRope = Instantiate(ropeSet.ropeObject, ropeSet.transform);
    newRope.transform.position = newRopePoint.transform.position;
    newRope.ropeStartPoint.SetParent(transform);
    newRope.ropeEndPoint.SetParent(newRopePoint.transform);
    newRope.ropeStartPoint.localPosition = Vector3.zero;
    newRope.ropeEndPoint.localPosition = Vector3.zero;

Here is a video : Video
Can anyone show me the direction where I do the mistake?
Thanks!
Reply
#2
When/how are you parenting the rope to a solver? Keep in mind that the rope will start simulating right away after placing it under a solver. Changing its transform will no longer have any effect afterwards, only objects it is attached to.

Instantiate the rope, move it around, then parent it to a solver.
Reply
#3
Yes, that solved the problem! I positioned the rope and then give one yield break before parenting to solver in case somebody would need it.

Thanks !
Reply