I have an equation which I am scripting onto GameObjectB…
Part of this equation is GameObjectB’s position… What is the easiest way of subbing these coordinates into the script…
The following script is assigned to GameObjectB… it is intended to transform the position of GameObjectB along the z axis relative to the position of GameObjectA and a futher variable named MyFloat…
1 using UnityEngine;
2 using System.Collections;
3
4 public class GameObjectBPositionScript : MonoBehaviour {
5 float MyFloat = 2.5;
6
7 // Update is called once per frame
8 void Update () {
9 transform.Translate ( 0f, 0f, GameObject A’s Position / MyFloat );
10 }
11 }
I need to be doing this for two dozen other game objects at the same time also…
Many thanks Unity’ers ![]()