Im trying to figure out a way to have a child’s object match a game-objects position on the x only.
So far i have Vector3 pos = childObject.localPosition; //pos.x needs to eqaul NonChildObjects position on the X; //We also clamp x because we don't want it to travel outside of local positions 0 to 1 pos.x = mathf.clamp(pos.x, 0, 1); pos.y = 0; pos.z = 0; childobject.localPosition = pos;
Basically imagine a slider. So when my NonChildObject moves around. The child object(slider) is following the NonChildObject on the x axis up until its clamped. Hope this makes sense.
Any help, as always, is appreciated.