Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Assigning target to ParticleAttchment component at runtime
#3
(20-12-2019, 08:41 AM)josemendez Wrote: Works fine for me. Keep in mind that setting the target or particle group at runtime, will attach the particles at their current positions. So if the rope is being simulated, the position will of course be different of the one it would be used at editor time.

If you wish to make sure they're at a certain position, just move the particles in the particle group prior to attaching them.

If you can provide a picture/gif of your issue I will be glad to help further. Sonrisa

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;
   }
}
Reply


Messages In This Thread
RE: Assigning target to ParticleAttchment component at runtime - by VirtualCucumber - 20-12-2019, 09:56 AM