I grab an object colliders[0] by parenting it to a snapPoint on my handobject. The grabbed object colliders[0], then child of the snapPoint.transform, will start a ParticleSystem component, triggered by the grab action. Particle SimulationSpace is Local.
I can do this procedure when parenting to the handobject. When parenting to the snapPoint (which is an empty child of handobject), the object grabbing works, but the ParticleSystem on the grabbed object starts with an offset.
Here is the code snippet, script is a component of grabbing handobject; FadePart class lies on grabbed colliders[0]:
colliders[0].transform.SetParent(transform); // this works for parenting to handobject
colliders[0].GetComponent().FadeOut(); // this starts ParticleSystem correctly
But what I need is this:
public Transform snapPoint;
colliders[0].transform.SetParent(snapPoint); // parents correctly to snapPoint on handobj
colliders[0].GetComponent().FadeOut(); // this now starts ParticleSystem in offset
How do I make sure, the ParticleSystem starts correctly on the grabbed object on snapPoint?
↧