Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to edit the splines in the sprite shape controller via script, unity

i want to make an animation that's gonna bend the string by holding and dragging a crossbow. For this, i am trying to use Sprite Shape Controller, which i am very new to. But apparently, i can't use the standard animation tool for this purpose. Also i can't figure out how to do it via script. So it would be very nice if you could help. game screenshot

I tried to find a solution on internet, but haven't been able to find a useful solution for my problem

like image 556
Ozemirh Avatar asked Dec 14 '25 06:12

Ozemirh


1 Answers

I figured out the solution while looking through the unity's official tutorial for Sprite Shape Controller.

private SpriteShapeController sprite;
private Spline spline;

sprite = GetComponent<SpriteShapeController>();
spline = sprite.spline;
spline.SetPosition(1, new Vector3(spline.GetPosition(1).x, -.35f));
like image 97
Ozemirh Avatar answered Dec 16 '25 22:12

Ozemirh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!