Move objects on specific axis of other objects while in editor?
I want to indicate a territory between 4 pylons.
To make my life easier i wanted to use OnDrawGizmos() to move the pylons according to other pylons, to keep a rectangular shape.
Example: TOP LEFT Pylon should follow Z Axis of TOP RIGHT Pylon and X Axis of BOTTOM LEFT Pylon. And so on.
Any ideas how to approach it?
The Problem i encounter is, that only one is reacting correctly because it's overwritten by the next:
void OnDrawGizmos()
{
Vector3 posTL = markerTL.transform.position;
Vector3 posBL = markerBL.transform.position;
//Vector3 posTR = markerTR.transform.position;
//Vector3 posBR = markerBR.transform.position;
Vector3 TLmarker = new Vector3(markerBL.transform.position.x,posTL.y, posTL.z);
markerTL.transform.position = TLmarker;
Vector3 BLmarker = new Vector3(markerTL.transform.position.x,posBL.y, posBL.z);
markerBL.transform.position = BLmarker;
//posBL.x = posTL.x;
//markerTL.transform.position = posBL;
}
Your answer
Follow this Question
Related Questions
A script behaviour has a different serialization layout... 7 Answers
GUI.Window. Wanting to allow clickthrough 0 Answers
OnValidate For Other Components? 0 Answers
[Simple question] Adding a new SerializedProperty to a SerializedObject 1 Answer
Creating an Inspector view that only changes on scene hierarchy selection or asset selection 1 Answer