Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Add Particles To Start, Remove From End
#1
Is it possible to add new particles to one end and remove from the other side at the same time? Like the rope is being sent from one side and received from the other ? 

I tried manipulating Cursor Mu and direction in many ways without success. Adding works perfectly, like in the Crane sample but removing "eats from one side" and only in one direction, even though I change the direction. I'm trying to make it look like someone is pulling and getting the rope from that end. Of course both ends are attached, so I'm using values like 0.02 or 0.98 instead of 0 and 1 in cursor mu.

Thanks in advance!
Reply
#2
(01-04-2021, 09:05 PM)darthmerth Wrote: Is it possible to add new particles to one end and remove from the other side at the same time? Like the rope is being sent from one side and received from the other ? 

Yes, but I don't think it's the easiest way to do what you want. See below.

(01-04-2021, 09:05 PM)darthmerth Wrote: I tried manipulating Cursor Mu and direction in many ways without success. Adding works perfectly, like in the Crane sample but removing "eats from one side" and only in one direction, even though I change the direction. 


This works fine in my tests, however it might give the impression that the rope is only reduced from one side due to the UV anchor point. The extruded renderer has a parameter that lets you specify the origin for uv (texture) coordinates in the rope mesh. By default this is 0 (the start of the rope), so eating away from the start will cause the texture to "slide" across the mesh giving the false impression that the rope is physically shrinking from the wrong side.

(01-04-2021, 09:05 PM)darthmerth Wrote: I'm trying to make it look like someone is pulling and getting the rope from that end. Of course both ends are attached, so I'm using values like 0.02 or 0.98 instead of 0 and 1 in cursor mu.

If the rope is not going to change its length (since both ends are attached), I think there's a much easier and performant way to achieve this: scroll the uv coordinates. This is how conveyor belts are typically done in many games: you don't move the mesh, instead you scroll the texture. Like this:

Code:
using UnityEngine;

public class RopeUVScroll : MonoBehaviour
{
    public float scrollSpeed = 1;
    private float scroll;

    void Update()
    {
        scroll += scrollSpeed * Time.deltaTime;
        GetComponent<Renderer>().material.SetTextureOffset("_MainTex", new Vector2(0, scroll));
    }
}
Reply