Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Assigning target to ParticleAttchment component at runtime
#4
(20-12-2019, 09:56 AM)VirtualCucumber Wrote: Here's a quick test https://imgur.com/a/k0qjzqK

The script is simple:
Code:
using UnityEngine;
using Obi;

public class DummyAttach : MonoBehaviour
{
   public Transform target;
   private ObiParticleAttachment _attachment;

   private void Start()
   {
       _attachment = GetComponent<ObiParticleAttachment>();

       if (target != null)
           _attachment.target = target;
   }
}

Quite probably, your rope is colliding with the yellow blocks during the first frame. So it is projected outside, gaining speed, and after the first frame Start() is executed and the rope bound in its current position.

Either:
- Deactivate collisions between the yellow blocks and the first few particles in the rope (recommended), setting either to the same phase as the other (See the last bit of: http://obi.virtualmethodstudio.com/tutor...aints.html)
- Force the rope particle group position in Start(), right before setting the target.
Reply


Messages In This Thread
RE: Assigning target to ParticleAttchment component at runtime - by josemendez - 20-12-2019, 10:02 AM