예제 #1
0
 internal static TeleportationAnchor CreateTeleportAnchorPlane()
 {
     GameObject plane = GameObject.CreatePrimitive(PrimitiveType.Plane);
     plane.name = "plane";
     TeleportationAnchor teleAnchor = plane.AddComponent<TeleportationAnchor>();
     return teleAnchor;
 }
        private void ConfigureTeleportationAnchor(TeleportationProperty teleportationAnchor, Transform prefabTransform)
        {
            TeleportationAnchor teleportAnchor = teleportationAnchor.GetComponent <TeleportationAnchor>();

            teleportAnchor.teleportAnchorTransform = prefabTransform;
            teleportAnchor.interactionLayerMask    = 1 << teleportLayer;
            teleportAnchor.customReticle           = Resources.Load <GameObject>(ReticlePrefab);
            teleportAnchor.matchOrientation        = MatchOrientation.TargetUpAndForward;
        }
        private void OnEnable()
        {
            TeleportationProperty teleportationProperty = target as TeleportationProperty;
            TeleportationAnchor   teleportAnchor        = teleportationProperty.GetComponent <TeleportationAnchor>();

            if (teleportationProperty.transform.childCount != 0 && teleportAnchor.teleportAnchorTransform.name == AnchorPrefabName)
            {
                isSetup = true;
            }
        }
예제 #4
0
        static void CreateTeleportationAnchor()
        {
            GameObject plane  = GameObject.CreatePrimitive(PrimitiveType.Plane);
            GameObject anchor = ObjectFactory.CreateGameObject("Anchor");

            anchor.transform.parent = plane.transform;

            TeleportationAnchor teleportationAnchor = plane.AddComponent <TeleportationAnchor>();

            plane.name = "Teleportation Anchor";
            teleportationAnchor.teleportAnchorTransform = anchor.transform;
        }
예제 #5
0
    // Update is called once per frame
    void Update()
    {
        TeleportationAnchor anchor = null;
        RaycastHit          hit;

        if (Physics.Raycast(CameraPivotTransform.position, CameraPivotTransform.forward, out hit, 100.0f, LayerMask.GetMask("Teleporter")))
        {
            anchor = hit.collider.GetComponentInParent <TeleportationAnchor>();
        }

        if (Input.GetMouseButton(1) && anchor != null)
        {//if the right button is pressed
            RigTransform.transform.position = anchor.transform.position;
        }
        else
        {
            UpdateLookRotation();
        }
    }
 protected void Awake()
 {
     renderers = GetComponentsInChildren <Renderer>();
     teleportationInteractable = GetComponent <TeleportationAnchor>();
 }