// Use this for initialization void Start() { //Instantiate simulated objects list simulatedObjects = new List <Motion3DObject>(); //Hook other GUI elements startStopButtonText = GameObject.Find("StartButton").GetComponentInChildren <Text>(); timeDisplayText = GameObject.Find("TimeInput").GetComponent <InputField>(); timeSlider = GameObject.Find("TimeSlider").GetComponent <TimeSlider>(); //TODO: conflict add //Hook Scene Controller sceneController = gameObject.GetComponent <Motion3DSceneController>(); //Initialize problem setup motion3Dsetup = new Motion3DSetup(DefaultProblem.exprX, DefaultProblem.exprY, DefaultProblem.exprZ, new Dictionary <string, double>(), DefaultProblem.order); //Set default forward solve time forwardSolveTime = Motion3DConstants.forwardSolveTime_default; //Set the object model to copy from objectModel = GameObject.Find("ObjectModel"); objectModel.SetActive(false); //Set valid data interval and reset time. Use internals to avoid bugs with one not being set yet allObjectsDataLowerBound_internal = 0; allObjectsDataUpperBound_internal = 0; resetTime_internal = 0; //Hook vector field vectorField = gameObject.GetComponent <Motion3DVectorField>(); vectorField.DisableVectorField(); }
public void SanityCheck() { try{ GameObject control = new GameObject(); control.AddComponent <Motion3DVectorField>(); Motion3DVectorField sim = control.GetComponent <Motion3DVectorField>(); sim.Start(); } catch (Exception e) { Debug.LogAssertion(e); Assert.IsTrue(false); } }
public void ToggleVectorField() { GameObject control = new GameObject(); control.AddComponent <Motion3DVectorField>(); Motion3DVectorField sim = control.GetComponent <Motion3DVectorField>(); sim.Start(); sim.InitializeVectorField(); sim.Update(); ToggleVectorField(); Assert.AreEqual(sim.vectorField, 1); }
public void DecreaseSpacing() { GameObject control = new GameObject(); control.AddComponent <Motion3DVectorField>(); Motion3DVectorField sim = control.GetComponent <Motion3DVectorField>(); sim.Start(); sim.InitializeVectorField(); sim.Update(); sim.DecreaseSpacing(); Assert.IsFalse(Mathf.Approximately(sim.vectorField, 3f)); }
public void UpdateWithVectorField1() { try{ GameObject control = new GameObject(); control.AddComponent <Motion3DVectorField>(); Motion3DVectorField sim = control.GetComponent <Motion3DVectorField>(); sim.Start(); sim.InitializeVectorField(); sim.vectorField = 1; sim.Update(); } catch (Exception e) { Debug.LogAssertion(e); Assert.IsTrue(false); } }