void Awake() { /* layer change must be done before adding the Graphic components */ GameObject obj = new GameObject("Translation Vector Object"); obj.layer = gameObject.layer; obj.transform.parent = transform; obj.transform.localPosition = Vector3.zero; transVector = obj.AddComponent <VectorGraphic> (); Color color = Color.green; color.a = 0.4f; transVector.color = color; transVector.offset = 0.6f; transVector.maxLength = 3f; transVector.minLength = 0.25f; transVector.maxWidth = 0.16f; transVector.minWidth = 0.05f; transVector.upperMagnitude = 5; transVector.lowerMagnitude = threshold; transVector.exponentialScale = true; obj = new GameObject("Torque Vector Object"); obj.layer = gameObject.layer; obj.transform.parent = transform; obj.transform.localPosition = Vector3.zero; torqueVector = obj.AddComponent <VectorGraphic> (); color = XKCDColors.ReddishOrange; color.a = 0.6f; torqueVector.color = color; torqueVector.offset = 0.6f; torqueVector.maxLength = 3f; torqueVector.minLength = 0.25f; torqueVector.maxWidth = 0.16f; torqueVector.minWidth = 0.05f; torqueVector.upperMagnitude = 5; torqueVector.lowerMagnitude = threshold; torqueVector.exponentialScale = true; obj = new GameObject("Torque Circle Object"); obj.layer = gameObject.layer; obj.transform.parent = transform; obj.transform.localPosition = Vector3.zero; torqueCircle = obj.AddComponent <CircularVectorGraphic> (); MoI = gameObject.AddComponent <MomentOfInertia> (); }
void Awake() { /* layer change must be done before adding the Graphic components */ transVector = getGameObject("Translation Vector Object").AddComponent <MarkerVectorGraphic> (); Color color = Color.green; color.a = 0.4f; transVector.setColor(color); torqueVector = getGameObject("Torque Vector Object").AddComponent <MarkerVectorGraphic> (); color = XKCDColors.ReddishOrange; color.a = 0.6f; torqueVector.setColor(color); torqueCircle = getGameObject("Torque Circle Object").AddComponent <CircularVectorGraphic> (); MoI = gameObject.AddComponent <MomentOfInertia> (); }
void Awake() { /* layer change must be done before adding the Graphic components */ transVector = getGameObject ("Translation Vector Object").AddComponent<MarkerVectorGraphic> (); Color color = Color.green; color.a = 0.4f; transVector.setColor(color); torqueVector = getGameObject ("Torque Vector Object").AddComponent<MarkerVectorGraphic> (); color = XKCDColors.ReddishOrange; color.a = 0.6f; torqueVector.setColor(color); torqueCircle = getGameObject ("Torque Circle Object").AddComponent<CircularVectorGraphic> (); MoI = gameObject.AddComponent<MomentOfInertia> (); Events.RootPartPicked += RootPartPicked; Events.RootPartDropped += RootPartDropped; }