⚙️Custom Shape

circle-check

You can create your custom shape generation scripts! It's easy!

To create a custom shape you can create new class and inherit it from the base class "RopechainShape":

using TIM;
using UnityEngine;

public class CustomShape : RopechainShape
{
    public override bool IsReadyToUse()
    {
        
    }

    public override Vector3 GetElementPosition(float elementLength, int elementIndex, int elementsCount, bool useWorldSpace)
    {
        
    }

    public override int GetMaxElementsCount(float elementLength)
    {
        
    }
}

IsReadyToUse() means, that if Ropechain use your class, it will not throw an exception or crash PC etc. Just return true if it's ready to use.

GetElementPosition() must return the position of element. The function will be called multiple times per generation: it's Count value in Ropechain.

Return value in world space if useWorldSpace is true. If not: return in local space.

GetMaxElementsCount() must return the max available count of points can be generated for this shape

Lets create our CustomShape!

For example it will draw a simple circle:

Add component "CircleRopechainShape" and assign it to your Ropechain:

works, but not looped

Use can toggle Looped to have looped circle:

Works but rope renderer is not perfect, so it can look twisted in some places:

Chain renderering looks better:

Good luck!

Last updated