void Start() { _placementComponent = this.GetComponent <TwoHandManipulatable>(); _placementComponent.enabled = false; _interactivity = this.GetComponent <InteractiveToggle>(); //_interactivity.enabled = false; }
/// <summary> /// Start method fills the fields. /// </summary> void Start() { // Find elements and fill fields txt = statusText.GetComponentInChildren <TextMesh>(); initialMiniMapScale = miniMapObject.transform.localScale; sh = toolbarObject.GetComponent <SolverHandler>(); srv = toolbarObject.GetComponent <SolverRadialView>(); thm = miniMapObject.GetComponent <TwoHandManipulatable>(); ft = mapObject.GetComponent <FollowTransformations>(); tbManipulate_1_1 = interactables.Find(x => x.name == "ToolbarManipulate-1-1"); tbManipulate_1_2 = interactables.Find(x => x.name == "ToolbarManipulate-1-2"); tbManipulate_2_1 = interactables.Find(x => x.name == "ToolbarManipulate-2-1"); tbManipulate_2_2 = interactables.Find(x => x.name == "ToolbarManipulate-2-2"); tbManipulate_2_3 = interactables.Find(x => x.name == "ToolbarManipulate-2-3"); tbManipulate_3_1 = interactables.Find(x => x.name == "ToolbarManipulate-3-1"); tbModelOverlay_1_1 = interactables.Find(x => x.name == "ToolbarModelOverlay-1-1"); tbModelOverlay_1_2 = interactables.Find(x => x.name == "ToolbarModelOverlay-1-2"); tbModelOverlay_1_3 = interactables.Find(x => x.name == "ToolbarModelOverlay-1-3"); // Start in model overlay mode leaveManipulate(); enterModelOverlay(); rdd.enabled = false; aboutDialog.SetActive(false); }
public void Start() { lastPos = transform.localPosition; lastRot = transform.localRotation; lastScale = transform.localScale; twoHandManipulatable = GetComponent <TwoHandManipulatable>(); StartCoroutine(SyncTransform()); }
/// <summary> /// Enables <see cref="TwoHandManipulatable"/>. /// </summary> private void EnableTwoHand() { // Make sure not already enabled if (twoHandManipulatable != null) { return; } // Add component twoHandManipulatable = gameObject.AddComponent <TwoHandManipulatable>(); // Set manipulations and constraints twoHandManipulatable.ManipulationMode = manipulationMode; twoHandManipulatable.RotationConstraint = rotationConstraint; // Allow single hand as well twoHandManipulatable.EnableEnableOneHandedMovement = true; }
private void end() { try { //unsubscribe myTwoHandManipulatable.StartedManipulating -= startedManipulation; myTwoHandManipulatable.StoppedManipulating -= stoppedmanipulation; } catch { } //make invisible setRenderes(false); //remove the script Destroy(myTwoHandManipulatable); myTwoHandManipulatable = null; }
// Use this for initialization void Start() { _sliderCommand = GetComponentInParent <SlidersCommands>(); _handManipulatable = GameObject.Find("/rotor").GetComponent <TwoHandManipulatable>(); _syncedCursor = GameObject.Find("/SyncedCursor").GetComponent <SyncedCursor>(); _messageHandlers = new Dictionary <HoloMessageType, MessageCallback>() { { HoloMessageType.DebugMsg, _sliderCommand.ShowServerMsg }, { HoloMessageType.ChangeSlider, _sliderCommand.NetControlOnSlider }, { HoloMessageType.ChangeModel, _handManipulatable.SyncFromNetwork }, { HoloMessageType.ChangeCursor, _syncedCursor.SyncFromNetwork } }; if (SharingStage.Instance.IsConnected) { Connected(); } else { SharingStage.Instance.SharingManagerConnected += Connected; } }
private void init() { zPositionCopy = transform.localPosition.z; myTwoHandManipulatable = gameObject.AddComponent <TwoHandManipulatable>(); //optional, no null check myTwoHandManipulatable.BoundingBoxPrefab = myBoundingBox; myTwoHandManipulatable.ManipulationMode = manipulationMode; hasBeenMoved = false; //make visible setRenderes(true); myTwoHandManipulatable.StartedManipulating += startedManipulation;//subscribe to manipulationStart myTwoHandManipulatable.StoppedManipulating += stoppedmanipulation; }
public override void enter() { base.enter(); if (inputStateMachine.targetTransform == null) { return; } twoHandManipulatable = inputStateMachine.targetTransform.GetComponent <TwoHandManipulatable>(); if (twoHandManipulatable == null) { twoHandManipulatable = inputStateMachine.targetTransform.gameObject.AddComponent <TwoHandManipulatable>(); } twoHandManipulatable.enabled = false; placeable = inputStateMachine.targetTransform.GetComponent <Placeable>(); gestureRecognizer = new GestureRecognizer(); gestureRecognizer.SetRecognizableGestures(GestureSettings.Tap); gestureRecognizer.Tapped += TappedEvent; // Start looking for gestures. gestureRecognizer.StartCapturingGestures(); }
/// <summary> /// Makes any hologram into an interactible one /// You can now move, rotate or scale it with your hands /// </summary> public void MakeBoundingBoxInteractible(GameObject obj) { Rigidbody body = obj.AddComponent <Rigidbody>(); body.mass = 100; body.useGravity = false; body.isKinematic = true; //Set all the boundingBox rig's settings bbRig = obj.AddComponent <BoundingBoxRig>(); bbRig.ScaleHandleMaterial = handle; bbRig.RotateHandleMaterial = handle; bbRig.InteractingMaterial = handleGrabbed; bbRig.BoundingBoxPrefab = BoundingBoxPrefab; bbRig.AppBarPrefab = AppBarPrefab; TwoHandManipulatable twoHand = obj.AddComponent <TwoHandManipulatable>(); twoHand.HostTransform = obj.transform; twoHand.BoundingBoxPrefab = BoundingBoxPrefab; obj.tag = "BoundingBox"; }
private void Start() { annotation = ""; bbMagnitude = GameObject.Find("City").transform.localScale.magnitude; twohandScript = GameObject.Find("City").GetComponent <TwoHandManipulatable>(); }
// Use this for initialization private void Start() { twoHandManipulatable = GetComponent <TwoHandManipulatable>(); }
private void config(GameObject[] models, NetworkManager nw) { foreach (GameObject prefab in models) { if (prefab) { if (!prefab.GetComponent <NetworkIdentity>()) { // add network identity NetworkIdentity ni = prefab.AddComponent <NetworkIdentity>(); ni.localPlayerAuthority = true; } // add network tranform if (!prefab.GetComponent <NetworkTransform>()) { NetworkTransform nt = prefab.AddComponent <NetworkTransform>(); nt.transformSyncMode = NetworkTransform.TransformSyncMode.SyncTransform; nt.sendInterval = 0.05f; } /* * // add Authority * if (!prefab.GetComponent<Authority>()) { * prefab.AddComponent<Authority>(); * } */ // add rigidbody Rigidbody rb = prefab.GetComponent <Rigidbody>(); if (rb) { rb.useGravity = true; rb.isKinematic = true; } else { rb = prefab.AddComponent <Rigidbody>(); rb.useGravity = true; rb.isKinematic = true; } // GazeResponder if (prefab.GetComponent <GazeResponder>() == null) { prefab.AddComponent <GazeResponder>(); } // MeshRenderer if (prefab.GetComponent <MeshRenderer>() == null) { prefab.AddComponent <MeshRenderer>(); } // add coilder if (!CheckColliderExist(prefab)) { AddCollider(prefab); } // TapResponder if (prefab.GetComponent <TapResponder>() == null) { prefab.AddComponent <TapResponder>(); } // AudioSource if (prefab.GetComponent <AudioSource>() == null) { AudioSource source = prefab.AddComponent <AudioSource>(); source.clip = clip; } // keywords if (prefab.GetComponent <Keywords>() == null) { prefab.AddComponent <Keywords>(); } // TwoHandManipulatable if (prefab.GetComponent <TwoHandManipulatable>() == null) { TwoHandManipulatable twoHand = prefab.AddComponent <TwoHandManipulatable>(); twoHand.ManipulationMode = ManipulationMode.RotateAndScale; twoHand.BoundingBoxPrefab = BoxPrefabs; } // BoundingBoxRig if (prefab.GetComponent <BoundingBoxRig>() == null) { BoundingBoxRig box = prefab.AddComponent <BoundingBoxRig>(); box.ScaleHandleMaterial = scaleMaterial; box.RotateHandleMaterial = rotateMaterial; box.InteractingMaterial = interactMaterial; box.BoundingBoxPrefab = BoxPrefabs; box.appBarPrefab = barPrefabs; box.scaleRate = 3.0f; box.maxScale = 100.0f; } } nw.spawnPrefabs.Add(prefab); ClientScene.RegisterPrefab(prefab); } }