Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Rope static attachment seems to lag behind the moving object it's attached to
#1
You can see what I mean here: https://youtu.be/cMG1YjnYDwM

The rope has an attachment to the character's hand, but it follows a bit behind the char as you move.

Solver is on FixedUpdate, character is being moved through physical forces. Both the character and the rope have interpolate on.

Code for the attachment is here, in case there's something about the initial setup that's causing problems:

Code:
public void AttachParticle(RopeChar ropeChar, int particleIndex)
    {
        attachedRopeChar = ropeChar;

        // Create a new attachment and set it to be attached to the character's hand
        attachment = obiRope.gameObject.AddComponent<ObiParticleAttachment>(); 
        attachment.target = attachedRopeChar.attachTransform;
                   
        // Handle gameplay of attached char (swings from hinge, the rope is just visual and used for collision detection)
        attachedRopeChar.AttachToRope(this);

        // Move the collided particle to the char's hand pos
        UnityEngine.Vector3 relativePlayerPos = attachedRopeChar.attachTransform.position - solver.transform.position;
        solver.positions.SetVector3(particleIndex, relativePlayerPos);
   
        // Create a new particle group and assign it the particle that you collided with
        ObiSolver.ParticleInActor particleInActor = solver.particleToActor[particleIndex];
       
        ObiParticleGroup group = ScriptableObject.CreateInstance<ObiParticleGroup>();
        group.particleIndices.Add(particleInActor.indexInActor); // index of the particle in the actor
        attachment.particleGroup = group;
    }
Reply


Messages In This Thread
Rope static attachment seems to lag behind the moving object it's attached to - by ShawnF - 25-07-2024, 02:26 PM