#Stretching Scale
1 messages · Page 1 of 1 (latest)
My hold notes are doing that. They shouldn't be, that was unintended
I want them to scale according to the distance between two parts of the actual hold note, see below
but for some reason my code does not necessarily provide the outcome I'm expecting, if i provide code, can somebody help?
oh okay let me elaborate
the bars are
- wayy too tall
- going outside of the boundaries of the TopOfNote and BottomOfNote (those tiny things in this picture)
and how are these things being drawn?
are they Images on a canvas?
sprite renderers? planes?
SpriteRenderers
how's the hierarchy set up?
so TopOfNote is sitting by itself, and then the bar and BottomOfNote are both under "child"?
yes because TopOfNote has to wait a certain amount of time before moving downward, if I child it to "child" then it'll move with child
ah, it appears in advance of the note starting to fall down?
it appears after certain time (after note falls down)
its meant to be an effect where note infinitely goes downward until Top is touching the trigger of the Hitbox, which is another issue by itself but yeah
i dont know if there is a better way to just fill the space between the two areas with one single "Middle" being stretched among them or multiple "Middle"s
so how are you computing the size of the middle graphic?
i'd kinda guess you're sclaing both "child" and "Middle"
with this: ```cs
float distance = Mathf.Abs(TopOfNote.transform.position.y - BottomOfNote.transform.position.y);
float newYScale = distance * 1f;
float newYPosition = newYScale / 2.0f; // get new Y based on the current scale
Vector3 newScale = new Vector3(1.0f, newYScale, 1.0f);
Vector3 newPosition = new Vector3(MiddleOfNote.transform.position.x, MiddleOfNote.transform.position.y + newYPosition, MiddleOfNote.transform.position.z);
MiddleOfNote.transform.localScale = Vector3.Lerp(MiddleOfNote.transform.localScale, newScale, Time.deltaTime * 5.0f); // and interpolate yeye
does the error get worse when the notes get longer?
yes..
perhaps the middle part isn't one unit tall when at a scale of 1
okay
i've fixed that issue now it's a slightly bit different
they all just start goign upward