Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Rope centre control
#4
(22-09-2023, 03:17 PM)Alexander34 Wrote: thanks for the advice on how to find the middle of the rope, now I need to figure out how to move the centre particle steadily without jerks etc.

_obiRope.solver.positions.SetVector3(middleElementIndex, transform.position); works too fast and the particle returns to its position in the very next frame

besides, even if we move this asynchronously and via Vector3.Lerp, when we move this central particle, the other particles in the rope don't reach for it, and I need to exactly grab the centre of the rope and move the players elsewhere.

Hi,

Again depends on the exact results you’re after, but setting the position of the particle won’t prevent it from going back near its original position as a result of the simulation trying to keep the rope’s length intact.

If you want to completely override the position of a particle so that the simulation can’t affect it, set the particle’s inverse mass to 0, see the description of invMasses array in the manual:

Quote:Inverse mass:
Inverse mass for each particle. An inverse mass of 0 means the particle's mass is infinite, so its position will be unaffected by dynamics (allowing you to override it manually).

This is what static attachments do internally: set the inverse mass to zero to make sure the simulation won’t mess with that particle’s position, then set a custom position value.

Note that when moving a single particle, all other particles in the rope won’t immediately adjust their positions as a result: it will take a few frames of simulation for the rope to react to what is essentially teleporting a part of it. If you want to eg. teleport the entire rope, you must set the position of all its particles.

Kind regards,
Reply


Messages In This Thread
Rope centre control - by Alexander34 - 21-09-2023, 05:48 PM
RE: Rope centre control - by josemendez - 22-09-2023, 08:55 AM
RE: Rope centre control - by Alexander34 - 22-09-2023, 03:17 PM
RE: Rope centre control - by josemendez - 22-09-2023, 08:13 PM