#Stretching Scale

1 messages · Page 1 of 1 (latest)

pulsar coral
#

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?

clear heath
#

I'm not clear what the problem is.

#

Are the bars too tall?

pulsar coral
pulsar coral
# pulsar coral

the bars are

  1. wayy too tall
  2. going outside of the boundaries of the TopOfNote and BottomOfNote (those tiny things in this picture)
clear heath
#

and how are these things being drawn?

#

are they Images on a canvas?

#

sprite renderers? planes?

pulsar coral
clear heath
#

how's the hierarchy set up?

pulsar coral
clear heath
#

so TopOfNote is sitting by itself, and then the bar and BottomOfNote are both under "child"?

pulsar coral
clear heath
#

ah, it appears in advance of the note starting to fall down?

pulsar coral
#

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

clear heath
#

so how are you computing the size of the middle graphic?

#

i'd kinda guess you're sclaing both "child" and "Middle"

pulsar coral
# clear heath so how are you computing the size of the middle graphic?

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

clear heath
#

does the error get worse when the notes get longer?

pulsar coral
#

yes..

clear heath
#

perhaps the middle part isn't one unit tall when at a scale of 1

pulsar coral
#

i've fixed that issue now it's a slightly bit different

#

they all just start goign upward