Align a vector3 with parent's up-vector.

Hi,
I’m (very) new to Unity and my vector-math is buried deep in my subconscious, next to my knowledge of 80s music… but I’m sure this question is straight-forward for anyone with minimal experience in Unity/basic-math.

I have a gameObject (a ‘gauge-needle’), and I created a behavior-script (c# component) that uses two Vector3 coordinates to represent points at some distance from the gauge-needle. To be precise, the two vectors represent “min” and “max” coordinates for the gauge-needle.

Now, the gauge-needle is parented inside a dashboard-gameObject, which can be moved around… Moving the dashboard also moves the needle, but as you can guess, this doesn’t move my min-max vertices.

How may I:
(a) detect that the parent’s position/rotation are changing?
(b) move my vertices accordingly, so that they follow the dashboard’s “up” axis?

I would like to avoid creating gameObjects for the min & max vertices, I don’t mind doing the math, I just need someone to point me in the right direction. Of course, my approach might be all wrong, so I’m open to new strategies on how to achieve this.

Thanks in advance for any help you can give me.

Well, if you use the local variables in the transform (localPosition, localRotation, localScale) that will only affect the object in relation to it’s parent. So, if the parent dashboard is set to rotate with the camera, and you set your min/max in local coordinates, you can do it all in local space and the dashboard transform will handle the move to world space.

Found my error. My editor-script’s “OnSceneGUI” was using :

Handles.PositionHandle(component.MinPosition, Quaternion.identity);

instead of

Handles.PositionHandle(component.MinPosition, component.transform.rotation);

which explains why rotating the parent game object did not rotate my vertices.

I would still like to thank you @FortisVenaliter for your post!